Bug #984 Updated: round() works bad
| From: | Bug Database | Date: | Thu, 10 Dec 1998 14:01:53 +0000 |
| Subject: | Bug #984 Updated: round() works bad | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-2740@lists.php.net to get a copy of this message | ||
ID: 984
Updated by: zeev
Reported By: segi@active.ch
Status: Closed
Bug Type: Misbehaving function
Assigned To:
Comments:
This has to do with the fact that floating point numbers
have limited accuracy.
0.5 is never represented as 0.5000000... with zeros all the way
to infinity, but usually as something like
0.49999999999999999998
1.5 may be represented as 1.50000000000002, etc.
Simply, you cannot rely on 0.5 being accurate, and thus
the behavir of round() can be considered undefined.
Full Bug description available at: http://ca.php.net/bugs.php3?id=984
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net