note 100994 added to function.round
| From: | omnibus at omnibus dot edu dot pl | Date: | Fri, 19 Nov 2010 10:26:22 +0000 |
| Subject: | note 100994 added to function.round | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174176@lists.php.net to get a copy of this message | ||
Beware strange behaviour if number is negative and precision is bigger than the actual number of
digits after comma.
round(-0.07, 4);
returns
-0.07000000000000001
So if you validate it against a regular expression requiring the maximum amount of digits after
comma, you'll get into trouble.
----
Server IP: 82.177.164.100
Probable Submitter: 178.73.8.10
----
Manual Page -- http://www.php.net/manual/en/function.round.php
Edit -- https://master.php.net/note/edit/100994
Del: integrated -- https://master.php.net/note/delete/100994/integrated
Del: useless -- https://master.php.net/note/delete/100994/useless
Del: bad code -- https://master.php.net/note/delete/100994/bad+code
Del: spam -- https://master.php.net/note/delete/100994/spam
Del: non-english -- https://master.php.net/note/delete/100994/non-english
Del: in docs -- https://master.php.net/note/delete/100994/in+docs
Del: other reasons-- https://master.php.net/note/delete/100994
Reject -- https://master.php.net/note/reject/100994
Search -- https://master.php.net/manage/user-notes.php