ID: 43053 Updated by: [EMAIL PROTECTED] Reported By: owner at dragon-hearts dot net Status: Verified Bug Type: Scripting Engine problem Operating System: Centos4 PHP Version: 5CVS-2007-10-25 New Comment:
The explanation is quite simple: the number are floats. There is not guarantee that "1200000.00" is actually represented and/or stored like that. In this particular case, "1300000.00" is stored like "1299999.99", so there are no zeros to compress. Previous Comments: ------------------------------------------------------------------------ [2007-10-25 13:41:44] [EMAIL PROTECTED] That last comment's script gives the same output for me, there's definately something strange going on here. :) ------------------------------------------------------------------------ [2007-10-22 16:51:25] rbro at hotmail dot com I am also running into this issue but only for certain float values. The original example posted works correctly for me, but other float values are printed in scientific notation while others aren't. It is related to the issue I reported in bug 42871 which was marked bogus. I am running against php5.2-200710221430. Reproduce code: --------------- <?php echo 1200000.00."\n"; echo 1300000.00."\n"; echo 1400000.00."\n"; echo 1500000.00."\n"; Expected result: ---------------- 1200000 1300000 1400000 1500000 Actual result: -------------- 1.2E+6 1300000 1.4E+6 1500000 ------------------------------------------------------------------------ [2007-10-22 10:25:22] owner at dragon-hearts dot net I tried it with small numbers too try this $var1=0.00001; $var2=1; echo $var1*$var2; It prints out as 1.0E-5 Instead of 0.00001 ------------------------------------------------------------------------ [2007-10-22 08:13:33] [EMAIL PROTECTED] Works fine for me too. ------------------------------------------------------------------------ [2007-10-20 15:41:28] owner at dragon-hearts dot net Description: ------------ When using mathematical processes on numbers over 1 million the result comes out in scientific notation instead of as a normal integer. Tested on PHP 5.2.1 it works as expected on 5.2.2 and above it doesn't. I checked the change log and nothing is mentioned about this. Reproduce code: --------------- $var1=1; $var2=7000000; echo $var1*$var2; Expected result: ---------------- 7000000 Actual result: -------------- 7E+6 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43053&edit=1