ID: 42432
Updated by: [EMAIL PROTECTED]
-Summary: Bug #41811 round() for large numbers ending with
zeroes
Reported By: zoxx at konto dot pl
Status: Open
-Bug Type: Strings related
+Bug Type: Documentation problem
Operating System: FreeBSD
PHP Version: 5.2.3
New Comment:
It's not working any differently than in PHP 4. Internally it's the
same value. Reclassified.
Previous Comments:
------------------------------------------------------------------------
[2007-08-27 09:23:22] zoxx at konto dot pl
It is not described in manual.
Additional tests (FreeBSD, Windows XP SP 1):
<?php
echo 4100000*1.0;
?>
expected result: 4100000
actual result: 4.1E+6
Notice:
1) it is not float precision problem
2) script is working correctly on php4
------------------------------------------------------------------------
[2007-08-27 08:45:10] [EMAIL PROTECTED]
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
------------------------------------------------------------------------
[2007-08-26 19:59:53] zoxx at konto dot pl
Description:
------------
Bug related with Bugs #41811, #41152.
It's not really round() problem but string conversion made by echo or
concatenation with string.
It is serious bug with strong consequences:
- php4 was free with that 'feature' so old correctly working scripts
could fail with php5
- data that is inserted to mysql with exponent notation to mysql
integer fields is cutted to digits (so if you insert 1.41E+7 '1' integer
is inserted instead)
- data could be not displayed correctly, not correctly inserted to
files or passed to external systems (and so on...)
- it is unrelated with 'precision' php.ini configuration item, so
unexpected by programmer
Reproduce code:
---------------
<form action="testval.php" method=POST>
<input type=text name=val>
</form>
<?php
echo $val*100.0;
?>
Expected result:
----------------
input: 410000
output: 41000000
Actual result:
--------------
input: 410000
output: 4.1E+7
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42432&edit=1