xref: /PHP-7.1/tests/lang/bug24640.phpt (revision 8d217db3)
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===DONE===
38<?php exit(0); ?>
39--EXPECTF--
401.7000000000000001E+300
41float(1.7E+300)
421.7E+300
431.7E+300
44------
451.7000000000000001E-300
46float(1.7E-300)
471.7E-300
481.7E-300
49------
501.7000000000000002E+79
51float(1.7E+79)
521.7E+79
531.7E+79
54------
551.6999999999999999E-79
56float(1.7E-79)
571.7E-79
581.7E-79
59------
601.7E+80
61float(1.7E+80)
621.7E+80
631.7E+80
64------
651.7E-80
66float(1.7E-80)
671.7E-80
681.7E-80
69------
701.7E+81
71float(1.7E+81)
721.7E+81
731.7E+81
74------
751.6999999999999999E-81
76float(1.7E-81)
771.7E-81
781.7E-81
79------
80I%s
81float(I%s)
82I%s
83I%s
84------
851.6999810742105611E-319
86float(1.69998107421E-319)
871.69998107421E-319
881.69998107421E-319
89------
90I%s
91float(I%s)
92I%s
93I%s
94------
951.7000798873397294E-320
96float(1.70007988734E-320)
971.70007988734E-320
981.70007988734E-320
99------
100I%s
101float(I%s)
102I%s
103I%s
104------
1051.6995858216938881E-321
106float(1.69958582169E-321)
1071.69958582169E-321
1081.69958582169E-321
109------
110I%s
111float(I%s)
112I%s
113I%s
114------
1150.0
116float(0)
1170
1180
119------
120I%s
121float(I%s)
122I%s
123I%s
124------
1250.0
126float(0)
1270
1280
129------
130===DONE===
131