note 66807 added to function.floor
| From: | JaredFine at osu1 dot php dot net | Date: | Tue, 30 May 2006 03:16:30 +0000 |
| Subject: | note 66807 added to function.floor | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-112521@lists.php.net to get a copy of this message | ||
Due to the floating point precision issue (http://www.php.net/float) if you round() one additional
decimal point prior to calling floor() you will get the expected result.
For example:
echo floor((0.1 + 0.7) * 10); // echo's 7
echo floor(round((0.1 + 0.7) * 10, 1)); // echo's 8
----
Server IP: 216.194.113.175
Probable Submitter: 66.67.213.105
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.floor.php
Edit -- http://master.php.net/note/edit/66807
Del: integrated -- http://master.php.net/note/delete/66807/integrated
Del: useless -- http://master.php.net/note/delete/66807/useless
Del: bad code -- http://master.php.net/note/delete/66807/bad+code
Del: spam -- http://master.php.net/note/delete/66807/spam
Del: non-english -- http://master.php.net/note/delete/66807/non-english
Del: in docs -- http://master.php.net/note/delete/66807/in+docs
Del: other reasons-- http://master.php.net/note/delete/66807
Reject -- http://master.php.net/note/reject/66807
Search -- http://master.php.net/manage/user-notes.php