Welcome! Log In Create A New Profile

Advanced

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

Posted by Craig Duncan 
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
Le mer. 19 avr. 2017 à 19:19, Craig Duncan <[email protected]> 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
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
Sorry, only registered users may post in this forum.

Click here to login