note 120183 added to function.round
| From: | Anonymous | Date: | Thu, 17 Nov 2016 23:33:03 +0000 |
| Subject: | note 120183 added to function.round | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-207156@lists.php.net to get a copy of this message | ||
Note that PHP 5.3 didn't just introduce $mode, it rewrote the rounding implementation
completely to eliminate many kinds of rounding errors common to rounding floating point values.
That's why round() gives you the correct result even when floor/ceil don't.
For example, floor(0.285 * 100 + 0.5) VS round(0.285*100 + 0.5). First one gives 28, second one
gives 29.
More details here: https://wiki.php.net/rfc/rounding
----
Server IP: 72.52.91.14
Probable Submitter: 178.223.30.85
----
Manual Page -- http://php.net/manual/en/function.round.php
Edit -- https://master.php.net/note/edit/120183
Del: integrated -- https://master.php.net/note/delete/120183/integrated
Del: useless -- https://master.php.net/note/delete/120183/useless
Del: bad code -- https://master.php.net/note/delete/120183/bad+code
Del: spam -- https://master.php.net/note/delete/120183/spam
Del: non-english -- https://master.php.net/note/delete/120183/non-english
Del: in docs -- https://master.php.net/note/delete/120183/in+docs
Del: other reasons-- https://master.php.net/note/delete/120183
Reject -- https://master.php.net/note/reject/120183
Search -- https://master.php.net/manage/user-notes.php