From:             
Operating system: 
PHP version:      5.3.2
Package:          Math related
Bug Type:         Feature/Change Request
Bug description:Negating zero does not produce negative zero

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 bug report at http://bugs.php.net/bug.php?id=52355&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=52355&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=52355&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=52355&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=52355&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52355&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=52355&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=52355&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=52355&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=52355&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=52355&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=52355&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=52355&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=52355&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=52355&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52355&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52355&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=52355&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=52355&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=52355&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=52355&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=52355&r=mysqlcfg

Reply via email to