ID: 20688 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Bogus Bug Type: Math related Operating System: windows PHP Version: 4.2.3 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php there are quite a few bug reports on this. adding floats can produce unpredicable results you could try using bcmath or sprintf $temp=-1.0; for($i=0;$i<=10;$i++){ $temp=(float) sprintf("%.2f",$temp+0.2); echo "<br>".$temp; } Previous Comments: ------------------------------------------------------------------------ [2002-11-27 19:42:49] [EMAIL PROTECTED] <?php $temp=-1.0; for($i=0;$i<=10;$i++) { $temp=$temp+0.2; echo "<br>".$temp; } ?> the output is : -0.8 -0.6 -0.4 -0.2 -5.55111512313E-017 0.2 0.4 0.6 0.8 1 1.2 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20688&edit=1
