diff options
| author | Dmitry Stogov <dmitry@php.net> | 2008-09-15 11:47:16 +0000 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@php.net> | 2008-09-15 11:47:16 +0000 |
| commit | 1474d9dfad906b926247677a8ba608d245b8d255 (patch) | |
| tree | d1836d83b5fafbd04faf6ac916be66ee223d716c /Zend | |
| parent | 612c93b78b45995ae34b37de38a42d2f1f29efa3 (diff) | |
| download | php-git-1474d9dfad906b926247677a8ba608d245b8d255.tar.gz | |
Fixed bug #43053 (Regression: some numbers shown in scientific notation). (int-e at gmx dot de)
some 64bit test files may need to be fixed
Diffstat (limited to 'Zend')
| -rw-r--r-- | Zend/tests/bug43053.phpt | 14 | ||||
| -rw-r--r-- | Zend/tests/hex_overflow_32bit.phpt | 2 | ||||
| -rw-r--r-- | Zend/tests/zend_strtod.phpt | 2 | ||||
| -rw-r--r-- | Zend/zend_strtod.c | 9 |
4 files changed, 17 insertions, 10 deletions
diff --git a/Zend/tests/bug43053.phpt b/Zend/tests/bug43053.phpt new file mode 100644 index 0000000000..646aa97d0b --- /dev/null +++ b/Zend/tests/bug43053.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #43053 (Regression: some numbers shown in scientific notation) +--FILE-- +<?php +echo 1200000.00."\n"; +echo 1300000.00."\n"; +echo 1400000.00."\n"; +echo 1500000.00."\n"; +?> +--EXPECT-- +1200000 +1300000 +1400000 +1500000 diff --git a/Zend/tests/hex_overflow_32bit.phpt b/Zend/tests/hex_overflow_32bit.phpt index 36e9a7e9d3..0f192f3497 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 1b11be0388..7f4bca5966 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 a65b738b53..bc2ca97b19 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; } |
