ID: 43487 Updated by: [EMAIL PROTECTED] Reported By: jm at wo dot cz -Status: Bogus +Status: Feedback Bug Type: Strings related Operating System: Linux PHP Version: 5.2.5 New Comment:
Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.php.net/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to "Open". Thank you for your interest in PHP. Floats might be imprecise... they shouldn't be wrong. I can't reproduce this though. Previous Comments: ------------------------------------------------------------------------ [2007-12-03 18:16:43] [EMAIL PROTECTED] 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. If you would like to know more about "floats" and what IEEE 754 is read this: http://docs.sun.com/source/806-3568/ncg_goldberg.html Thank you for your interest in PHP. . ------------------------------------------------------------------------ [2007-12-03 16:53:25] jm at wo dot cz Description: ------------ Some float numbers are incorrectly converted to string values: I found it by playing with eval and getting wrong results. Then I did: echo floatval('3.86e-6'); // output: 3.86E-6 echo floatval('1.01e-6'); // output: 1.01E-6 But echo floatval('1E-6'); // output: :.0E-7 But one can do: $f=1E-6; echo $f; // output: .0E-7 So it must be a problem with float to string conversion. Reproduce code: --------------- $f=1E-6; echo $f; // output: :.0E-7 Expected result: ---------------- 1.0E-6 Actual result: -------------- :.0E-7 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43487&edit=1
