note 86707 deleted from function.round by danbrown
| From: | danbrown@php.net | Date: | Fri, 31 Oct 2008 01:16:13 +0000 |
| Subject: | note 86707 deleted from function.round by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-145985@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 think about this too!