#34967 [NEW]: $y=1.3+0.1>1.4

From: Date: Mon, 24 Oct 2005 10:53:02 +0000
Subject: #34967 [NEW]: $y=1.3+0.1>1.4
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-86973@lists.php.net to get a copy of this message
From: davidyht516 at hotmail dot com Operating system: windows xp home PHP version: 5.0.5 PHP Bug Type: Math related Bug description: $y=1.3+0.1>1.4 Description: ------------ The erro is: 1.3+0.1>1.4 Reproduce code: --------------- $y=1.3+0.1; if($y==1.4){$y-=1.4; echo "yes y-1.4=$y";} else{$y-=1.4; echo "no y-1.4=$y";} Expected result: ---------------- The result of the code should be: yes y-1.4=0 Actual result: -------------- Actual result is: no y-1.4=2.2e-12 It happens only when $y=1.3+0.1; If changing the code to $y=1.2+0.2; then the result is correct. What is going on here? -- Edit bug report at http://bugs.php.net/?id=34967&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34967&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34967&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34967&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34967&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34967&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34967&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34967&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34967&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34967&r=support Expected behavior: http://bugs.php.net/fix.php?id=34967&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34967&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34967&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34967&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34967&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34967&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34967&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34967&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34967&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34967&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34967&r=mysqlcfg

« previous php.bugs (#86973) next »