Re: number_format() = "-0.00"
| From: | Nikita Nefedov | Date: | Fri, 25 Nov 2016 10:56:42 +0000 |
| Subject: | Re: number_format() = "-0.00" | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-97178@lists.php.net to get a copy of this message | ||
On Fri, 25 Nov 2016 11:10:47 +0300, Rasmus Lerdorf <rasmus@lerdorf.com> wrote:
On Thu, Nov 24, 2016 at 11:54 PM, Craig Duncan <php@duncanc.co.uk> wrote:I'm afraid majority of people (myself included) see number_format and money_format not as a IEEE 754-accurate float value rendering functions. Instead people use them for printing human-readable numbers, which usually excludes implementation quirks such as negative zero orI've submit a PR (https://github.com/php/php-src/pull/2220) to fix a bug ( https://bugs.php.net/bug.php?id=73581). Kalle suggested I run the change by here to see if there are any concerns or feedback about merging this?This doesn't seem like a bug to me. Our floating point is all IEEE 754 and as per IEEE 754 -0.00 is the correct and expected result here. -Rasmus
2.0 represented as 1.999~.