You are here: ROUND « PHP Programming Language « IT news, forums, messages
ROUND

Posted by kkmigas@gmail.com on 12/21/06 16:49

Can some one explain if this can be fixed using php.ini settings ?

echo "round 20.545 -".round(20.545,2)."<br>";
echo "round 20.555 -".round(20.555,2)."<br>";
echo "number_format 20.545 -".number_format(20.545, 2, ',',
'.')."<br>";
echo "number_format 20.555 -".number_format(20.555, 2, ',',
'.')."<br>";

PHP Version 4.3.0 / FreeBSD
round 20.545 -20.55
round 20.555 -20.56
number_format 20.545 -20,55
number_format 20.555 -20,55

PHP Version 4.4.4 / CENTOS
round 20.545 -20.55
round 20.555 -20.55
number_format 20.545 -20,55
number_format 20.555 -20,55

PHP Version 5.1.4 / Windows NT
round 20.545 -20.55
round 20.555 -20.56
number_format 20.545 -20,55
number_format 20.555 -20,56

I know that the round always goes for the odd but this is not
consistence with the SO running PHP


Thanks

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация