|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-06-26 01:10 UTC] rasmus@php.net
-Status: Open
+Status: Bogus
[2010-06-26 01:10 UTC] rasmus@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 07:00:02 2025 UTC |
Description: ------------ PHP version: 5.3.2 I think addition operator have a problem. Pls run the script below and the code in "Test script" box. <?php $a = 16.99; $b = 6.99; $c = 10; if ($a < ($b + $c)) { print "<"; } else if ($a == ($b + $c)) { print "=="; } else { print ">"; } print "\n"; print $a .":". ($b + $c); print "\n"; ?> If the number is 16.98, the result will be ok. Test script: --------------- <?php for ($x=0;$x<100;$x++ ) { for ($y=10;$y<100;$y++) { $str = $x.'.'.$y; print $str; $a = floatVal($str); $b = floatVal($x); $c = floatVal('0.'.$y); if ($a < ($b + $c)) { print "<"; } else if ($a == ($b + $c)) { print "=="; } else { print ">"; } print "\n"; } }