note 86707 added to function.round
| From: | Montoya at osu1 dot php dot net | Date: | Thu, 30 Oct 2008 22:31:34 +0000 |
| Subject: | note 86707 added to function.round | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145981@lists.php.net to get a copy of this message | ||
<?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!
----
Server IP: 64.71.164.2
Probable Submitter: 98.221.124.112
----
Manual Page -- http://www.php.net/manual/en/function.round.php
Edit -- https://master.php.net/note/edit/86707
Del: integrated -- https://master.php.net/note/delete/86707/integrated
Del: useless -- https://master.php.net/note/delete/86707/useless
Del: bad code -- https://master.php.net/note/delete/86707/bad+code
Del: spam -- https://master.php.net/note/delete/86707/spam
Del: non-english -- https://master.php.net/note/delete/86707/non-english
Del: in docs -- https://master.php.net/note/delete/86707/in+docs
Del: other reasons-- https://master.php.net/note/delete/86707
Reject -- https://master.php.net/note/reject/86707
Search -- https://master.php.net/manage/user-notes.php