Skip to content

Commit bd8085a

Browse files
committed
Zend: Update dtoa.c to the latest version
1 parent 43a7692 commit bd8085a

5 files changed

Lines changed: 2441 additions & 553 deletions

File tree

‎NEWS‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ PHP NEWS
1111
. Improved performance of integer to string conversion, used by string casts,
1212
echo, implode(), json_encode(), serialize() and other places, by emitting
1313
two digits per step. (Alexander Danilov)
14+
. Updated dtoa.c to the latest version, improving float conversion
15+
performance. (Alexander Danilov)
1416
. Fixed bug GH-25788 (clone() with properties corrupts memory with JIT when
1517
__clone() keeps a reference and the result is discarded). (Tomasz Kowalczyk)
1618

‎UPGRADING‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ PHP 8.7 UPGRADE NOTES
2222
- Core:
2323
. Block declaration support for the encoding declare has been removed as it
2424
did not function properly.
25+
. Float to string conversion no longer leaves a trailing zero when rounding
26+
an exact tie down: sprintf('%.3G', 370500.0) now returns "3.7E+5".
2527

2628
- Curl:
2729
. curl_multi_exec() now throws a TypeError when $still_running cannot be
@@ -233,6 +235,10 @@ PHP 8.7 UPGRADE NOTES
233235
traversed the whole graph again after every 10000 possible roots.
234236
. Improved performance of integer to string conversion (string casts, echo,
235237
implode(), json_encode(), serialize(), var_export() and others).
238+
. Improved performance of float to string conversion (string casts,
239+
sprintf(), number_format(), json_encode(), serialize(), var_export() and
240+
others) and of converting long numeric strings to float ((float) casts,
241+
json_decode(), unserialize() and others).
236242

237243
- DOM:
238244
. Parsing HTML with Dom\HTMLDocument or innerHTML uses much less memory for
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
No trailing zeros are left when an exact tie is rounded down during float to string conversion
3+
--INI--
4+
precision=14
5+
serialize_precision=10
6+
--FILE--
7+
<?php
8+
9+
var_dump(sprintf('%.3G', 370500.0));
10+
var_dump(sprintf('%.9g', -81320560005.0));
11+
var_dump((string) 183037915746105.0);
12+
var_dump(var_export(81320560005.0, true));
13+
var_dump(json_encode(81320560005.0));
14+
var_dump(serialize(81320560005.0));
15+
16+
?>
17+
--EXPECT--
18+
string(6) "3.7E+5"
19+
string(13) "-8.132056e+10"
20+
string(18) "1.830379157461E+14"
21+
string(12) "8.132056E+10"
22+
string(12) "8.132056e+10"
23+
string(15) "d:8.132056E+10;"

0 commit comments

Comments
 (0)