Welcome! Log In Create A New Profile

Advanced

[PHP-DEV] [RFC] Prevent number_format() from returning negative zero

Posted by Craig Duncan 
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
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
Sorry, only registered users may post in this forum.

Click here to login