#42432 [Bgs->Opn]: Bug #41811 round() for large numbers ending with zeroes

From: Date: Mon, 27 Aug 2007 09:23:22 +0000
Subject: #42432 [Bgs->Opn]: Bug #41811 round() for large numbers ending with zeroes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-116703@lists.php.net to get a copy of this message
ID: 42432 User updated by: zoxx at konto dot pl Reported By: zoxx at konto dot pl -Status: Bogus +Status: Open Bug Type: Strings related Operating System: FreeBSD PHP Version: 5.2.3 New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [2007-08-27 08:45:10] jani@php.net 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

« previous php.bugs (#116703) next »