Req #52355 [Opn]: Negating zero does not produce negative zero
| From: | spoon dot reloaded at gmail dot com | Date: | Fri, 16 Jul 2010 06:34:29 +0000 |
| Subject: | Req #52355 [Opn]: Negating zero does not produce negative zero | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-152460@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52355&edit=1
ID: 52355
User updated by: spoon dot reloaded at gmail dot com
Reported by: spoon dot reloaded at gmail dot com
Summary: Negating zero does not produce negative zero
Status: Open
Type: Feature/Change Request
Package: Math related
PHP Version: 5.3.2
New Comment:
Nor can you specify -0 as a float literal:
var_dump(-0.);
float(0)
Previous Comments:
------------------------------------------------------------------------
[2010-07-16 08:31:54] spoon dot reloaded at gmail dot com
Description:
------------
Using the unary negation operator on a float 0 (positive zero) value,
simply returns positive zero again, instead of -0 (negative zero), like
it does in other languages.
var_dump(-(0.));
float(0)
The negative zero exists and can be displayed properly, so that is not
the problem:
var_dump(-1/INF);
float(-0)
But for some reason there is no easy way to access it.
Test script:
---------------
var_dump(-(0.));
var_dump(-1/INF);
Expected result:
----------------
float(-0)
float(-0)
Actual result:
--------------
float(0)
float(-0)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52355&edit=1