From:             
Operating system: openSuSE
PHP version:      5.3.2
Package:          Scripting Engine problem
Bug Type:         Feature/Change Request
Bug description:Arithmetic Operator: Addition maybe have a problem

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";

        }

}




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

Reply via email to