note 41818 deleted from function.number-format by betz
| From: | betz@php.net | Date: | Fri, 23 Apr 2004 08:33:00 +0000 |
| Subject: | note 41818 deleted from function.number-format by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-68577@lists.php.net to get a copy of this message | ||
Note Submitter: www.delegated.net
----
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.