ID: 27119 Updated by: [EMAIL PROTECTED] Reported By: gnz at amorfo dot com -Status: Open +Status: Bogus Bug Type: Math related Operating System: Windows/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. try bcmath... Previous Comments: ------------------------------------------------------------------------ [2004-02-02 01:11:26] gnz at amorfo dot com Description: ------------ Hi, Im getting the wrong result performing a simple sum operation. Ive been able to reproduce this on Windows with PHP 4.3.4 Windows with PHP 4.3.5 RC1 Linux with PHP 4.3.2 Reproduce code: --------------- <?php $a = 10.95; $b = 11; $c = $b-$a; echo $c; ?> Expected result: ---------------- 0.05 Actual result: -------------- 0.050000000000001 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27119&edit=1
