From:             
Operating system: fedora 13
PHP version:      5.3.3
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:"less than" operator returning true even if numbers are equal

Description:
------------
I am using the following PHP version:



PHP 5.3.3 (cli) (built: Jul 22 2010 15:57:00) 



Info: re-typing everything to (float), (double) or "no type specified" does
not fix the problem.

Test script:
---------------
<? 

$min=(float)44;

$max=(float)54545;



$step=(float)($max-$min)/10;



if($step && $step>0)

{

        $i=$min;

        while($i<$max)

        {

                echo($i." &lt; $max ");

                var_dump($i,$max,$step);

                echo("<br />");

                $i+=$step;

        }

}

if($i>$max) echo("WHAT?");  ?> 

Expected result:
----------------
44 < 54545 float(44) float(54545) float(5450.1) 

5494.1 < 54545 float(5494.1) float(54545) float(5450.1) 

10944.2 < 54545 float(10944.2) float(54545) float(5450.1) 

16394.3 < 54545 float(16394.3) float(54545) float(5450.1) 

21844.4 < 54545 float(21844.4) float(54545) float(5450.1) 

27294.5 < 54545 float(27294.5) float(54545) float(5450.1) 

32744.6 < 54545 float(32744.6) float(54545) float(5450.1) 

38194.7 < 54545 float(38194.7) float(54545) float(5450.1) 

43644.8 < 54545 float(43644.8) float(54545) float(5450.1) 

49094.9 < 54545 float(49094.9) float(54545) float(5450.1) 



Actual result:
--------------
44 < 54545 float(44) float(54545) float(5450.1) 

5494.1 < 54545 float(5494.1) float(54545) float(5450.1) 

10944.2 < 54545 float(10944.2) float(54545) float(5450.1) 

16394.3 < 54545 float(16394.3) float(54545) float(5450.1) 

21844.4 < 54545 float(21844.4) float(54545) float(5450.1) 

27294.5 < 54545 float(27294.5) float(54545) float(5450.1) 

32744.6 < 54545 float(32744.6) float(54545) float(5450.1) 

38194.7 < 54545 float(38194.7) float(54545) float(5450.1) 

43644.8 < 54545 float(43644.8) float(54545) float(5450.1) 

49094.9 < 54545 float(49094.9) float(54545) float(5450.1) 

54545 < 54545 float(54545) float(54545) float(5450.1) 

WHAT?

-- 
Edit bug report at http://bugs.php.net/bug.php?id=53222&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=53222&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=53222&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=53222&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=53222&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53222&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=53222&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=53222&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=53222&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=53222&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=53222&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=53222&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=53222&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=53222&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=53222&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53222&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53222&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=53222&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=53222&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=53222&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=53222&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=53222&r=mysqlcfg

Reply via email to