ID: 26874 Updated by: [EMAIL PROTECTED] Reported By: yehlu at ms1 dot hinet dot net -Status: Open +Status: Bogus Bug Type: *Math Functions Operating System: linux PHP Version: 4.3.4 New Comment:
Floating point values have a limited precision. Hence a value might not have the same string representation after any processing. That also includes writing a floating point value in your script and directly printing it without any mathematical operations. Thank you for your interest in PHP. . Previous Comments: ------------------------------------------------------------------------ [2004-01-12 01:48:14] yehlu at ms1 dot hinet dot net Description: ------------ <?php $a = 3100; echo "\$a :".$a."\n"; $a *= 1.025; echo "\$a * 1.025 :".$a."\n"; echo "round \$a:".round($a)."\n"; //get 3177 echo "round \$a:".round("$a")."\n"; //get 3178 $b = "3177.5"; echo "\$b:".$b."\n"; echo "round \$b:".round($b)."\n"; //get 3178 ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26874&edit=1