#46780 [NEW]: Minus zero returned by simple multiplication of floating numbers

From: Date: Sat, 06 Dec 2008 12:08:58 +0000
Subject: #46780 [NEW]: Minus zero returned by simple multiplication of floating numbers
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-131672@lists.php.net to get a copy of this message
From: preechaw at gmail dot com Operating system: Windows XP PHP version: 5.2.7 PHP Bug Type: Math related Bug description: Minus zero returned by simple multiplication of floating numbers Description: ------------ -0.1 * 0; // returns -0 I believe it should return 0 without the minus sign. -- I will also submit another bug for the "BC math related" type. echo bcadd("-0.0", "-0.0", 1); // returns -0.0 echo bccomp("-0.0", "0", 1); // returns -1 -- Reproduce code: --------------- <?php echo -0.1 * 0; // returns -0 ?> Expected result: ---------------- 0 Actual result: -------------- -0 -- Edit bug report at http://bugs.php.net/?id=46780&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46780&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46780&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46780&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46780&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46780&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=46780&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46780&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46780&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46780&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46780&r=support Expected behavior: http://bugs.php.net/fix.php?id=46780&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46780&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46780&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46780&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46780&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46780&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46780&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46780&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46780&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46780&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46780&r=mysqlcfg

« previous php.bugs (#131672) next »