ID: 45117 User updated by: rudolphi at chemie dot uni-kl dot de Reported By: rudolphi at chemie dot uni-kl dot de -Status: Feedback +Status: Open Bug Type: Scripting Engine problem Operating System: Ubuntu 8.04 (32bit) PHP Version: 5.2.6 New Comment:
$ uname -a Linux rudolphi 2.6.24-19-generic #1 SMP Wed Jun 18 14:43:41 UTC 2008 i686 GNU/Linux $ php -n -r '$float=1e-6; var_dump($float, strval($float));' float(:.0E-7) string(6) ":.0E-7" $ php -v PHP 5.2.6 (cli) (built: May 29 2008 10:18:45) Copyright (c) 1997-2008 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies Previous Comments: ------------------------------------------------------------------------ [2008-07-15 21:11:20] [EMAIL PROTECTED] I can not reproduce this, check this out: # uname -a Linux linux5 2.6.20-1.2944.fc6 #1 SMP Tue Apr 10 17:46:00 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux # php -n -r '$float=1e-6; var_dump($float, strval($float));' float(1.0E-6) string(6) "1.0E-6" # php -v $ php -v PHP 5.2.7-dev (cli) (built: Jul 15 2008 04:32:33) .. Can you post the same here? ------------------------------------------------------------------------ [2008-05-28 13:24:21] rudolphi at chemie dot uni-kl dot de Description: ------------ When converting a number in exponential format with negative exponent of n=6,7,... strval (or implicit conversion to string) gives :.0E-(n+1) if there is no fractional part present. The error can be found both in the precompiled PHP 5.2.4 and self-compiled 5.2.6, but it cannot be reproduced under Windows or under PHP 5.2.3 Ubuntu 7.10 (64bit). Seems to be closely related to OS (?). Reproduce code: --------------- $float=1e-6; echo strval($float); Expected result: ---------------- 1e-6 or 1.0e-6 Actual result: -------------- :.0E-7 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45117&edit=1