ID: 19398 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Redhat 7.3 PHP Version: 4.2.2
Previous Comments: ------------------------------------------------------------------------ [2002-09-17 04:43:40] [EMAIL PROTECTED] Never compare floats for equalness! Thats like comparing two pieces of rope for exactly equal length -> you won't ever find an equal pair see for example the note on http://www.php.net/language.types.float ------------------------------------------------------------------------ [2002-09-13 20:03:14] [EMAIL PROTECTED] The script below produces a lot of output on two of our systems. One a 6 cpu ppro, the other a single cpu duron 950. Both boxes run redhat 7.3. One runs the php that came with redhat 7.3, the 6 cpu box runs php 4.2.2 that we compiled ourselves to add more options. For sample output of this script, with a phpinfo() call appended to it, go to: http://www.umci.com/testcode.phtml <? $start=0.01; while ($start <= 10) { // Removing the quotes from test's assignment will eliminate the // errors unless you uncomment the ++/-- down a fiew lines. $test="$start"; $test2=$start; ///////////////////////////////////////////////////////////////// // Uncommenting these two lines accentuates the problem a bit... ///////////////////////////////////////////////////////////////// //$test++; //$test--; if ($test!=$test2) echo "Comparison Result: \"$test\" != \"$test2\" ----- Shouldn't this be true?<br>"; $start = $start + 0.01; } ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19398&edit=1