note 41818 added to function.number-format
| From: | www dot delegated dot net at rn2 dot php dot net | Date: | Thu, 22 Apr 2004 21:32:49 +0000 |
| Subject: | note 41818 added to function.number-format | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-68561@lists.php.net to get a copy of this message | ||
It's worth running the code below to check how your system rounds if you are planning on using
the round function at all.
<?
echo "round(3.5): ".round(3.5)."\n";
echo "round(2.5): ".round(2.5)."\n";
echo "round(2.4): ".round(2.4)."\n";
echo "round(2.6): ".round(2.6)."\n";
echo "round(-3.5): ".round(-3.5)."\n";
echo "round(-2.5): ".round(-2.5)."\n";
echo "round(-2.4): ".round(-2.4)."\n";
echo "round(-2.6): ".round(-2.6)."\n";
?>
In my case (PHP 4.3.3 on RedHat 7.3), it rounds away from zero.
----
Manual Page -- http://www.php.net/manual/en/function.number-format.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41818
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41818&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41818&report=yes
Search -- http://master.php.net/manage/user-notes.php