diff --git a/Zend/tests/hex_overflow_32bit.phpt b/Zend/tests/hex_overflow_32bit.phpt index 36e9a7e..0f192f3 100644 --- a/Zend/tests/hex_overflow_32bit.phpt +++ b/Zend/tests/hex_overflow_32bit.phpt @@ -22,7 +22,7 @@ foreach ($doubles as $d) { echo "Done\n"; ?> --EXPECTF-- -float(4083360297110%d) +float(4.0833602971%dE+14) float(4.7223664828%dE+21) float(1.3521606402%dE+31) float(1.9807040628%dE+27) diff --git a/Zend/tests/zend_strtod.phpt b/Zend/tests/zend_strtod.phpt index 1b11be0..7f4bca5 100644 --- a/Zend/tests/zend_strtod.phpt +++ b/Zend/tests/zend_strtod.phpt @@ -15,5 +15,5 @@ echo "Done\n"; float(-100) float(808792757210) float(-4.5646456464565E+27) -float(-11276204760067000) +float(-1.1276204760067E+16) Done diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c index 77e5c82..7b8ab0c 100644 --- a/Zend/zend_strtod.c +++ b/Zend/zend_strtod.c @@ -1720,14 +1720,7 @@ ZEND_API char * zend_dtoa(double _d, int mode, int ndigits, int *decpt, int *sig if (value(d) > 0.5 + value(eps)) goto bump_up; else if (value(d) < 0.5 - value(eps)) { - /* cut ALL traling zeros only if the number of chars is greater than precision - * otherwise cut only extra zeros - */ - if (k < ndigits) { - while(*--s == '0' && (s - s0) > k); - } else { - while(*--s == '0'); - } + while(*--s == '0'); s++; goto ret1; } diff --git a/ext/standard/tests/general_functions/008.phpt b/ext/standard/tests/general_functions/008.phpt index bb633c3..f76c735 100644 --- a/ext/standard/tests/general_functions/008.phpt +++ b/ext/standard/tests/general_functions/008.phpt @@ -34,7 +34,7 @@ array(14) { [11]=> float(123456789012) [12]=> - float(1234567890120) + float(1.23456789012E+12) [13]=> float(1.23456789012E+19) } \ No newline at end of file diff --git a/ext/standard/tests/strings/printf.phpt b/ext/standard/tests/strings/printf.phpt index 13a8ed0..eb72dbf 100755 --- a/ext/standard/tests/strings/printf.phpt +++ b/ext/standard/tests/strings/printf.phpt @@ -645,10 +645,10 @@ Array -123456 123456 -123456 -120000 --120000 -+120000 --120000 +1.2e+5 +-1.2e+5 ++1.2e+5 +-1.2e+5 123456 -123456 1.0E+5 @@ -657,10 +657,10 @@ Array -123456 123456 -123456 -120000 --120000 -+120000 --120000 +1.2E+5 +-1.2E+5 ++1.2E+5 +-1.2E+5 *** Output for '%%%.2f' as the format parameter *** %12345678900.00 diff --git a/main/snprintf.c b/main/snprintf.c index 67ecd3a..262ea99 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -155,10 +155,7 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c *dst++ = '-'; } - for (i = 0; i < ndigit && digits[i] != '\0'; i++); - - if ((decpt >= 0 && decpt - i > 4) - || (decpt < 0 && decpt < -3)) { /* use E-style */ + if ((decpt >= 0 && decpt > ndigit) || decpt < -3) { /* use E-style */ /* exponential format (e.g. 1.2345e+13) */ if (--decpt < 0) { sign = 1;