Bug #64390 [Com]: round() corrupted
Edit report at https://bugs.php.net/bug.php?id=64390&edit=1
ID: 64390
Comment by: anon at anon dot anon
Reported by: bugzilla77 at gmail dot com
Summary: round() corrupted
Status: Not a bug
Type: Bug
Package: Math related
Operating System: Win 7
PHP Version: 5.5.0alpha5
Block user comment: N
Private report: N
New Comment:
>Negative zero in mathematics does not exist.
Then you should also report this against most programming environments that have ever existed,
because negative zero is that common, and is even part of an international standard for
floating-point representation.
https://en.wikipedia.org/wiki/Negative_zero
Previous Comments:
------------------------------------------------------------------------
[2013-03-08 12:09:56] johannes@php.net
Floating point values have a limited precision. Hence a value might
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly
printing it without any mathematical operations.
If you would like to know more about "floats" and what IEEE
754 is, read this:
http://www.floating-point-gui.de/
Thank you for your interest in PHP.
.
------------------------------------------------------------------------
[2013-03-08 11:45:17] bugzilla77 at gmail dot com
Description:
------------
Negative zero in mathematics does not exist.
Test script:
---------------
<?=round(-0.1)?>
Expected result:
----------------
0
Actual result:
--------------
-0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64390&edit=1
Thread (3 messages)