note 86706 deleted from function.round by felipe
| From: | felipe@php.net | Date: | Thu, 30 Oct 2008 23:06:14 +0000 |
| Subject: | note 86706 deleted from function.round by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-145983@lists.php.net to get a copy of this message | ||
Note Submitter: Montoya
----
<?php
$round1 = round(8.1246, 3); //8.125
$round2 = round($round1, 2); //8.13
echo $round2;
?>
To the commenter "Chris", if you can't see why this is mathematically wrong, please
stay away from math functions. And to the poster who jsut shared a function for
"multi-rounding" precisions, you should thing about this too!