#42432 [Csd]: large numbers ending with zeroes

From: Date: Thu, 22 Nov 2007 23:45:43 +0000
Subject: #42432 [Csd]: large numbers ending with zeroes
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-266@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: Closed Bug Type: Documentation problem Operating System: FreeBSD PHP Version: 5.2.3 New Comment: fine.. but it wasn't documentation problem Anyway we have solved it in our scripts, where it was most urgent, by adding special function to convert strings that may contain exponental numbers because this bug - eg. before sending query to mysql (it was easy because we have special class to call databases, but if you use mysql_something functions everywhere you are lucky less...): /** * function ConvExponent($str) * This function replaces exponent notation of float values in string */ function ConvExponent($str) { return preg_replace('#(\d+)\.(\d+)E(\+|\-)(\d+)#sie', 'sprintf(\'%F\',floatval($0))', $str); } Previous Comments: ------------------------------------------------------------------------ [2007-11-21 17:19:19] vrana@php.net This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. "Floating point numbers can be converted using the exponential notation (4.1E+6)." ------------------------------------------------------------------------ [2007-10-22 16:54:01] rbro at hotmail dot com I am running into this same issue. I just added a comment on bug 43053 which is describing the same issue. ------------------------------------------------------------------------ [2007-08-27 09:49:39] zoxx at konto dot pl The problem is not internal representation, but float -> string conversion made while 'echo' or while inserting to a string (like $txt="value: $val";). It is not working same as in php4 (I have tested that scripts with php4 too - the result is correct there: no exponent notation used). ------------------------------------------------------------------------ [2007-08-27 09:32:19] jani@php.net It's not working any differently than in PHP 4. Internally it's the same value. Reclassified. ------------------------------------------------------------------------ [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 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/42432 -- Edit this bug report at http://bugs.php.net/?id=42432&edit=1

« previous php.doc.bugs (#266) next »