xref: /PHP-8.4/tests/lang/bug24640.phpt (revision a9398056)
1--TEST--
2Bug #24640 (var_export and var_dump can't output large float)
3--INI--
4precision=12
5serialize_precision=17
6--FILE--
7<?php
8function test($v)
9{
10    echo var_export($v, true) . "\n";
11    var_dump($v);
12    echo "$v\n";
13    print_r($v);
14    echo "\n------\n";
15}
16
17test(1.7e+300);
18test(1.7e-300);
19test(1.7e+79);
20test(1.7e-79);
21test(1.7e+80);
22test(1.7e-80);
23test(1.7e+81);
24test(1.7e-81);
25test(1.7e+319);
26test(1.7e-319);
27test(1.7e+320);
28test(1.7e-320);
29test(1.7e+321);
30test(1.7e-321);
31test(1.7e+324);
32test(1.7e-324);
33test(1.7e+1000);
34test(1.7e-1000);
35
36?>
37--EXPECTF--
381.7000000000000001E+300
39float(1.7000000000000001E+300)
401.7E+300
411.7E+300
42------
431.7000000000000001E-300
44float(1.7000000000000001E-300)
451.7E-300
461.7E-300
47------
481.7000000000000002E+79
49float(1.7000000000000002E+79)
501.7E+79
511.7E+79
52------
531.6999999999999999E-79
54float(1.6999999999999999E-79)
551.7E-79
561.7E-79
57------
581.7E+80
59float(1.7E+80)
601.7E+80
611.7E+80
62------
631.7E-80
64float(1.7E-80)
651.7E-80
661.7E-80
67------
681.7E+81
69float(1.7E+81)
701.7E+81
711.7E+81
72------
731.6999999999999999E-81
74float(1.6999999999999999E-81)
751.7E-81
761.7E-81
77------
78I%s
79float(I%s)
80I%s
81I%s
82------
831.6999810742105611E-319
84float(1.6999810742105611E-319)
851.69998107421E-319
861.69998107421E-319
87------
88I%s
89float(I%s)
90I%s
91I%s
92------
931.7000798873397294E-320
94float(1.7000798873397294E-320)
951.70007988734E-320
961.70007988734E-320
97------
98I%s
99float(I%s)
100I%s
101I%s
102------
1031.6995858216938881E-321
104float(1.6995858216938881E-321)
1051.69958582169E-321
1061.69958582169E-321
107------
108I%s
109float(I%s)
110I%s
111I%s
112------
1130.0
114float(0)
1150
1160
117------
118I%s
119float(I%s)
120I%s
121I%s
122------
1230.0
124float(0)
1250
1260
127------
128