note 73925 deleted from function.round by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 16:18:26 +0000 |
| Subject: | note 73925 deleted from function.round by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154793@lists.php.net to get a copy of this message | ||
Note Submitter:
----
With regard to chafy at alo dot bg's not just previous; if the number 5.555 is displayed with
sufficient precision (more than about 16 digits) it will probably turn out to have been stored as
something like 5.554999999....9997, which would round down to 5.55.
Floating-point numbers should ALWAYS be regarded as being a little bit fuzzy. It's a
consequence of the fact that they're stored in binary but humans want them displayed in
decimal: you can't write one-tenth exactly as a binary expansion any more than you can write
one-seventh exactly as a decimal one.
See the warning note on the floating-point type page.