1--TEST--
2Test var_export() function with valid float values
3--INI--
4serialize_precision=17
5--FILE--
6<?php
7/* Prototype  : mixed var_export(mixed var [, bool return])
8 * Description: Outputs or returns a string representation of a variable
9 * Source code: ext/standard/var.c
10 * Alias to functions:
11 */
12
13echo "*** Testing var_export() with valid float values ***\n";
14// different valid  float values
15$valid_floats = array(
16	  "-2147483649" => (float)-2147483649, // float value
17	  "2147483648" => (float)2147483648,  // float value
18	  "-0x80000001" => (float)-0x80000001, // float value, beyond max negative int
19	  "0x800000001" => (float)0x800000001, // float value, beyond max positive int
20	  "020000000001" => (float)020000000001, // float value, beyond max positive int
21	  "-020000000001" => (float)-020000000001, // float value, beyond max negative int
22	  "0.0" => 0.0,
23	  "-0.1" => -0.1,
24	  "10.0000000000000000005" => 10.0000000000000000005,
25	  "10.5e+5" => 10.5e+5,
26	  "1e5" => 1e5,
27	  "1e-5" => 1e-5,
28	  "1e+5" => 1e+5,
29	  "1E5" => 1E5,
30	  "1E+5" => 1E+5,
31	  "1E-5" => 1E-5,
32	  ".5e+7" => .5e+7,
33	  ".6e-19" => .6e-19,
34	  ".05E+44" => .05E+44,
35	  ".0034E-30" => .0034E-30
36);
37/* Loop to check for above float values with var_export() */
38echo "\n*** Output for float values ***\n";
39foreach($valid_floats as $key => $float_value) {
40	echo "\n-- Iteration: $key --\n";
41	var_export( $float_value );
42	echo "\n";
43	var_export( $float_value, FALSE);
44	echo "\n";
45	var_dump( var_export( $float_value, TRUE) );
46	echo "\n";
47}
48
49?>
50===DONE===
51--EXPECT--
52*** Testing var_export() with valid float values ***
53
54*** Output for float values ***
55
56-- Iteration: -2147483649 --
57-2147483649.0
58-2147483649.0
59string(13) "-2147483649.0"
60
61
62-- Iteration: 2147483648 --
632147483648.0
642147483648.0
65string(12) "2147483648.0"
66
67
68-- Iteration: -0x80000001 --
69-2147483649.0
70-2147483649.0
71string(13) "-2147483649.0"
72
73
74-- Iteration: 0x800000001 --
7534359738369.0
7634359738369.0
77string(13) "34359738369.0"
78
79
80-- Iteration: 020000000001 --
812147483649.0
822147483649.0
83string(12) "2147483649.0"
84
85
86-- Iteration: -020000000001 --
87-2147483649.0
88-2147483649.0
89string(13) "-2147483649.0"
90
91
92-- Iteration: 0.0 --
930.0
940.0
95string(3) "0.0"
96
97
98-- Iteration: -0.1 --
99-0.10000000000000001
100-0.10000000000000001
101string(20) "-0.10000000000000001"
102
103
104-- Iteration: 10.0000000000000000005 --
10510.0
10610.0
107string(4) "10.0"
108
109
110-- Iteration: 10.5e+5 --
1111050000.0
1121050000.0
113string(9) "1050000.0"
114
115
116-- Iteration: 1e5 --
117100000.0
118100000.0
119string(8) "100000.0"
120
121
122-- Iteration: 1e-5 --
1231.0000000000000001E-5
1241.0000000000000001E-5
125string(21) "1.0000000000000001E-5"
126
127
128-- Iteration: 1e+5 --
129100000.0
130100000.0
131string(8) "100000.0"
132
133
134-- Iteration: 1E5 --
135100000.0
136100000.0
137string(8) "100000.0"
138
139
140-- Iteration: 1E+5 --
141100000.0
142100000.0
143string(8) "100000.0"
144
145
146-- Iteration: 1E-5 --
1471.0000000000000001E-5
1481.0000000000000001E-5
149string(21) "1.0000000000000001E-5"
150
151
152-- Iteration: .5e+7 --
1535000000.0
1545000000.0
155string(9) "5000000.0"
156
157
158-- Iteration: .6e-19 --
1596.0000000000000006E-20
1606.0000000000000006E-20
161string(22) "6.0000000000000006E-20"
162
163
164-- Iteration: .05E+44 --
1655.0000000000000001E+42
1665.0000000000000001E+42
167string(22) "5.0000000000000001E+42"
168
169
170-- Iteration: .0034E-30 --
1713.4000000000000001E-33
1723.4000000000000001E-33
173string(22) "3.4000000000000001E-33"
174
175===DONE===
176