From: jeb at webco dot tv
Operating system: Linux / Ubuntu or Fedora
PHP version: 5.1.4
PHP Bug Type: Math related
Bug description: Comparison operator fails with certain numbers
Description:
------------
Code 1 listed below does not work as expected. Code 2 does. Interesting
bug. If I replace the "<= 0.01" with "< 0.02", it does work as expected.
Reproduce code:
---------------
Code 1:
$data['low'] = 0.04;
$data['high'] = 0.05;
if ($data['high'] - $data['low'] <= 0.01)
print "it works";
Code 2:
$data['low'] = 0.02;
$data['high'] = 0.03;
if ($data['high'] - $data['low'] <= 0.01)
print "it works";
Expected result:
----------------
Both instances should print "it works."
Actual result:
--------------
Code 1 prints nothing.
Code 2 prints "it works".
--
Edit bug report at http://bugs.php.net/?id=37683&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=37683&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=37683&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=37683&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37683&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=37683&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37683&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37683&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37683&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37683&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37683&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=37683&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=37683&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37683&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37683&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37683&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37683&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37683&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37683&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37683&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37683&r=mysqlcfg