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 vlaues
15$valid_floats = array(
16	  "-2147483649" => -2147483649, // float value
17	  "2147483648" => 2147483648,  // float value
18	  "-0x80000001" => -0x80000001, // float value, beyond max negative int
19	  "0x800000001" => 0x800000001, // float value, beyond max positive int
20	  "020000000001" => 020000000001, // float value, beyond max positive int
21	  "-020000000001" => -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
58-2147483649
59string(11) "-2147483649"
60
61
62-- Iteration: 2147483648 --
632147483648
642147483648
65string(10) "2147483648"
66
67
68-- Iteration: -0x80000001 --
69-2147483649
70-2147483649
71string(11) "-2147483649"
72
73
74-- Iteration: 0x800000001 --
7534359738369
7634359738369
77string(11) "34359738369"
78
79
80-- Iteration: 020000000001 --
812147483649
822147483649
83string(10) "2147483649"
84
85
86-- Iteration: -020000000001 --
87-2147483649
88-2147483649
89string(11) "-2147483649"
90
91
92-- Iteration: 0.0 --
930
940
95string(1) "0"
96
97
98-- Iteration: -0.1 --
99-0.10000000000000001
100-0.10000000000000001
101string(20) "-0.10000000000000001"
102
103
104-- Iteration: 10.0000000000000000005 --
10510
10610
107string(2) "10"
108
109
110-- Iteration: 10.5e+5 --
1111050000
1121050000
113string(7) "1050000"
114
115
116-- Iteration: 1e5 --
117100000
118100000
119string(6) "100000"
120
121
122-- Iteration: 1e-5 --
1231.0000000000000001E-5
1241.0000000000000001E-5
125string(21) "1.0000000000000001E-5"
126
127
128-- Iteration: 1e+5 --
129100000
130100000
131string(6) "100000"
132
133
134-- Iteration: 1E5 --
135100000
136100000
137string(6) "100000"
138
139
140-- Iteration: 1E+5 --
141100000
142100000
143string(6) "100000"
144
145
146-- Iteration: 1E-5 --
1471.0000000000000001E-5
1481.0000000000000001E-5
149string(21) "1.0000000000000001E-5"
150
151
152-- Iteration: .5e+7 --
1535000000
1545000000
155string(7) "5000000"
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