note 11043 deleted from Floating point numbers by jeroen
| From: | jeroen@php.net | Date: | Wed, 23 May 2001 23:15:20 +0000 |
| Subject: | note 11043 deleted from Floating point numbers by jeroen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14218@lists.php.net to get a copy of this message | ||
The previous example (ralphcf@home.com) should work, but it will round toward zero. If you want to
round down, try the following:
floor($a/$b)*$b;
If you need to round up, try:
ceil($a/$b)*b);
Can someone recommend a statistically correct rounding formula (that is, one that rounds .5 toward
the even number)?