ID: 43487 User updated by: jm at wo dot cz Reported By: jm at wo dot cz -Status: Feedback +Status: Open Bug Type: Strings related Operating System: Linux PHP Version: 5.2.5 New Comment:
The CVS snapshot makes no difference, still getting the same incorrect strings. [EMAIL PROTECTED] ~]$ php -n -r '$f=array(1E-4, 1E-5, 1E-6, 1E-7, 1E-8); foreach ($f as $fval) echo $fval, "\n";' 0.0001 1.0E-5 :.0E-7 :.0E-8 1.0E-8 [EMAIL PROTECTED] ~]$ php -v PHP 5.2.6-dev (cli) (built: Jan 28 2008 16:13:46) Copyright (c) 1997-2008 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies Previous poster suggested a CPU-related issue. I have encountered this issue on the following CPUs: vendor_id : AuthenticAMD cpu family : 15 model : 5 model name : AMD Opteron(tm) Processor 248 stepping : 8 cpu MHz : 2205.074 vendor_id : GenuineIntel cpu family : 6 model : 13 model name : Intel(R) Pentium(R) M processor 1.80GHz stepping : 6 cpu MHz : 1800.000 vendor_id : AuthenticAMD cpu family : 15 model : 37 model name : AMD Opteron(tm) Processor 252 stepping : 1 cpu MHz : 2606.078 Previous Comments: ------------------------------------------------------------------------ [2008-01-28 07:59:48] oeriksson at mandriva dot com I get the same problem, but it seems related to what CPU is used. http://qa.mandriva.com/show_bug.cgi?id=37171 $ uname -a Linux foo.nux.se 2.6.24-server-0.rc8.2mdv #1 SMP Wed Jan 23 17:15:33 UTC 2008 i686 Intel(R) Pentium(R) 4 CPU 2.80GHz GNU/Linux $ php -r "var_dump(11.1/111);" float(0.0:) $ uname -a Linux oe.nux.tld 2.6.24-desktop-0.rc8.2mdv #1 SMP Wed Jan 23 18:12:45 CET 2008 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ GNU/Linux $ php -r "var_dump(11.1/111);" float(0.1) It works with 5.1.6 though. ------------------------------------------------------------------------ [2008-01-26 01:12:23] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows (zip): http://snaps.php.net/win32/php5.2-win32-latest.zip For Windows (installer): http://snaps.php.net/win32/php5.2-win32-installer-latest.msi ------------------------------------------------------------------------ [2008-01-16 09:20:36] lmalgras at tennaxia dot com I have the same problem with PHP 5.2.4 on Linux Reproduce code: --------------- php -n -r '$f=array(1E-4, 1E-5, 1E-6, 1E-7, 1E-8); foreach($f as $fval) echo $fval, "\n";' Expected result: ---------------- 0.0001 1.0E-5 1.0E-6 1.0E-7 1.0E-8 Actual result: -------------- 0.0001 1.0E-5 :.0E-7 :.0E-8 1.0E-8 I have test this code on several configurations with the following results : PHP 5.2.0 (Linux) : Actual result PHP 5.2.2 (Linux) : Actual result PHP 5.2.3 (Windows): Actual result ------------------------------------------------------------------------ [2007-12-06 23:59:16] jm at wo dot cz Obviously, I meant to say, the problem is with TWO numbers only: 1E-6 and 1E-7. J. ------------------------------------------------------------------------ [2007-12-06 23:55:54] jm at wo dot cz I got the same problem on another machine too, again PHP 5.2.5 with pretty much the same configuration. In fact, the problem exhibits also for version 5.2.4 on my machines. About the unknown configuration options: Thanks, I had seen the warning but did not have the time to edit my scripts and based on the message it seemed harmless to leave the options be for now. I am thinking that the problem and your inability to reproduce it could be due to some libraries that PHP uses that may be buggy in the versions on my systems. Can you please tell me what libraries, if any, to look for? Although the installed version of software are generally the latest stable releases, it is possible that a patch or a downgrade may be in order on some library/tool. Finally, the problem has so far appeared for 3 numbers only: $ php -n -r '$f=array(1E-4, 1E-5, 1E-6, 1E-7, 1E-8); foreach ($f as $fval) echo $fval, "\n";' 0.0001 1.0E-5 :.0E-7 :.0E-8 1.0E-8 Jan ------------------------------------------------------------------------ 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/43487 -- Edit this bug report at http://bugs.php.net/?id=43487&edit=1