[RFC] Prevent number_format() from returning negative zero

php.internals

Craig Duncan (PHP)

9 years ago
Hi internals. Following a brief discussion on the behaviour of number_format() last year I'd like to start discussion around an RFC to bring consistency to negative zero. When number_format() is passed -0 it doesn't display the negative sign, however if it's passed something that rounds to -0 then it does display the negative sign. https://3v4l.org/k4roB I believe these two operations should yield the same result. The RFC takes the stance that the rounding version should be changed to never display -0, but I'm open to hearing arguments to change number_format() to always display the negative sign when it's working with a negative number. https://wiki.php.net/rfc/number_format_negative_zero Thanks, Craig

Craig Duncan (PHP)

9 years ago
Just a reminder that I'll be putting the following RFC to vote in a few days. https://wiki.php.net/rfc/number_format_negative_zero I presume the silence is due to there being no more objections, so I look forward to the vote. Thanks, Craig