[PR][php-src][#1170][master] - #69161 Removing Signed Zeros - number_format
| From: | noreply@php.net | Date: | Wed, 11 Mar 2015 09:58:28 +0000 |
| Subject: | [PR][php-src][#1170][master] - #69161 Removing Signed Zeros - number_format | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-2717@lists.php.net to get a copy of this message | ||
You can view the Pull Request on github:
https://github.com/php/php-src/pull/1170
Pull Request Description:
It's possible to get a signed zero:
<?php
echo round(-0.0001, 2); // -0
?>
This is valid according to IEEE 754 so probably shouldn't be changed internally. However, for
display purposes, "-0" is needlessly confusing.
There's no simple way of removing it. I can call abs($num) but I need an if statement to only
call abs($num); when $num is -0.
My proposal is that number_format, which is used for display purposes, changes -0 into +0.
------
I saw some comments under the http://php.net/manual/en/function.round.php,
and they can't understand why the return value is '-0'.
What do you think?