[RFC] [VOTE] Prevent number_format() from returning negative zero

php.internals

Craig Duncan (PHP)

9 years ago
Hi everyone, The RFC for making *number_format()* consistent when dealing with negative zero is now in the voting phase. Voting will be open for 2 weeks and will close at 0:00 UTC on Wednesday 3rd May. https://wiki.php.net/rfc/number_format_negative_zero Thanks, Craig

Patrick ALLAERT

9 years ago
Le mer. 19 avr. 2017 à 19:19, Craig Duncan <php@duncanc.co.uk> a écrit :
> Hi everyone, > > The RFC for making *number_format()* consistent when dealing with negative > zero is now in the voting phase. > > Voting will be open for 2 weeks and will close at 0:00 UTC on Wednesday 3rd > May. > > https://wiki.php.net/rfc/number_format_negative_zero > > Thanks, > Craig >
Hi, I voted "no", because I think it's more important to avoid possible backward incompatibilities than fixing something which is hard to determine whether it is a bug or not. I'm personally very ok with: php > echo number_format(-1e-5); -0 What is non consistent to me is this: php > echo number_format(-0e-5); 0 php > echo -0e-5; -0 Since -0e-5 is a negatively signed 0, number_format(-0e-5) should return "-0" as well. Cheers, Patrick

Craig Duncan (PHP)

9 years ago
Voting has now closed and the RFC has passed with 14 votes for and 1 against. https://wiki.php.net/rfc/number_format_negative_zero Thanks to everybody that got involved. I've submitted a PR for the implementation: https://github.com/php/php-src/pull/2508 Thanks, Craig