|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-08-30 17:40 UTC] colder@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 15:00:01 2025 UTC |
Description: ------------ ---- Example #1 / FAIL (This should NOT FAIL, but it does) !!!!!!!!!!! $a=1.3333; $b=1.6666; $c=2.9999; $d=($a+$b); if($d != $c) { echo 'php have a serious bug ...'; } else { echo 'OK ...'; } //end if else // notice that currently I use number_format($d, 4, '.', '') to fix this, but is abnormal ! ---- ---- Example #2 / OK $a=4.3333; $b=4.6666; $c=8.9999; $d=($a+$b); if($d != $c) { echo 'php have a serious bug ...'; } else { echo 'OK ...'; } //end if // this seems that not raise that bug, ... hmmm ... very strange ---- I tested it on: PHP 4.4.9 PHP 5.2.9 PHP 5.2.10 PHP 4.4.4 (bundled with Zend Studio) It appears that all fail at Example #1 and should not ... !!! If you release a patch, please also patch the 4.4.9 version. Reproduce code: --------------- $a=1.3333; $b=1.6666; $c=2.9999; $d=($a+$b); if($d != $c) { echo 'php have a serious bug ...'; } else { echo 'OK ...'; } //end if else Expected result: ---------------- the output should be 'OK ...' but is not ! Actual result: -------------- 'php have a serious bug ...'