Bug #53865 [Com]: (float)0 * -1 = minus zero (-0)
| From: | dmitrij at stepanov dot lv | Date: | Fri, 28 Jan 2011 10:33:54 +0000 |
| Subject: | Bug #53865 [Com]: (float)0 * -1 = minus zero (-0) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-158266@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53865&edit=1
ID: 53865
Comment by: dmitrij at stepanov dot lv
Reported by: dmitrij at stepanov dot lv
Summary: (float)0 * -1 = minus zero (-0)
Status: Bogus
Type: Bug
Package: Scripting Engine problem
Operating System: Windows 7
PHP Version: 5.3.5
Block user comment: N
Private report: N
New Comment:
I guess the link should be http://en.wikipedia.org/wiki/IEEE_754
Previous Comments:
------------------------------------------------------------------------
[2011-01-28 11:23:02] derick@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://docs.sun.com/source/806-3568/ncg_goldberg.html
Thank you for your interest in PHP.
.
------------------------------------------------------------------------
[2011-01-28 10:03:40] dmitrij at stepanov dot lv
Description:
------------
See test script.
Test script:
---------------
var_dump( (float)0 * -1);
Expected result:
----------------
float(0)
Actual result:
--------------
float(-0)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53865&edit=1