1--TEST--
2Test round() - basic function test for round()
3--INI--
4precision=14
5--FILE--
6<?php
7echo "*** Testing round() : basic functionality ***\n";
8
9$values = array(123456789,
10                123.456789,
11                -4.5679123,
12                1.23E4,
13                -4.567E3,
14                0x234567,
15                067777777,
16                "1.234567",
17                "2.3456789e8");
18
19$precision = array(2,
20                8,
21                0x3,
22                04,
23                3.6,
24                "2",
25                "04",
26                "3.6",
27                "2.1e1",
28                true,
29                false);
30
31for ($i = 0; $i < count($values); $i++) {
32    echo "round: $values[$i]\n";
33    for ($j = 0; $j < count($precision); $j++) {
34        $res = round($values[$i], $precision[$j]);
35        echo "...with precision $precision[$j]-> ";
36        var_dump($res);
37    }
38}
39?>
40--EXPECTF--
41*** Testing round() : basic functionality ***
42round: 123456789
43...with precision 2-> float(123456789)
44...with precision 8-> float(123456789)
45...with precision 3-> float(123456789)
46...with precision 4-> float(123456789)
47
48Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d
49...with precision 3.6-> float(123456789)
50...with precision 2-> float(123456789)
51...with precision 04-> float(123456789)
52
53Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
54...with precision 3.6-> float(123456789)
55...with precision 2.1e1-> float(123456789)
56...with precision 1-> float(123456789)
57...with precision -> float(123456789)
58round: 123.456789
59...with precision 2-> float(123.46)
60...with precision 8-> float(123.456789)
61...with precision 3-> float(123.457)
62...with precision 4-> float(123.4568)
63
64Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d
65...with precision 3.6-> float(123.457)
66...with precision 2-> float(123.46)
67...with precision 04-> float(123.4568)
68
69Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
70...with precision 3.6-> float(123.457)
71...with precision 2.1e1-> float(123.456789)
72...with precision 1-> float(123.5)
73...with precision -> float(123)
74round: -4.5679123
75...with precision 2-> float(-4.57)
76...with precision 8-> float(-4.5679123)
77...with precision 3-> float(-4.568)
78...with precision 4-> float(-4.5679)
79
80Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d
81...with precision 3.6-> float(-4.568)
82...with precision 2-> float(-4.57)
83...with precision 04-> float(-4.5679)
84
85Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
86...with precision 3.6-> float(-4.568)
87...with precision 2.1e1-> float(-4.5679123)
88...with precision 1-> float(-4.6)
89...with precision -> float(-5)
90round: 12300
91...with precision 2-> float(12300)
92...with precision 8-> float(12300)
93...with precision 3-> float(12300)
94...with precision 4-> float(12300)
95
96Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d
97...with precision 3.6-> float(12300)
98...with precision 2-> float(12300)
99...with precision 04-> float(12300)
100
101Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
102...with precision 3.6-> float(12300)
103...with precision 2.1e1-> float(12300)
104...with precision 1-> float(12300)
105...with precision -> float(12300)
106round: -4567
107...with precision 2-> float(-4567)
108...with precision 8-> float(-4567)
109...with precision 3-> float(-4567)
110...with precision 4-> float(-4567)
111
112Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d
113...with precision 3.6-> float(-4567)
114...with precision 2-> float(-4567)
115...with precision 04-> float(-4567)
116
117Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
118...with precision 3.6-> float(-4567)
119...with precision 2.1e1-> float(-4567)
120...with precision 1-> float(-4567)
121...with precision -> float(-4567)
122round: 2311527
123...with precision 2-> float(2311527)
124...with precision 8-> float(2311527)
125...with precision 3-> float(2311527)
126...with precision 4-> float(2311527)
127
128Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d
129...with precision 3.6-> float(2311527)
130...with precision 2-> float(2311527)
131...with precision 04-> float(2311527)
132
133Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
134...with precision 3.6-> float(2311527)
135...with precision 2.1e1-> float(2311527)
136...with precision 1-> float(2311527)
137...with precision -> float(2311527)
138round: 14680063
139...with precision 2-> float(14680063)
140...with precision 8-> float(14680063)
141...with precision 3-> float(14680063)
142...with precision 4-> float(14680063)
143
144Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d
145...with precision 3.6-> float(14680063)
146...with precision 2-> float(14680063)
147...with precision 04-> float(14680063)
148
149Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
150...with precision 3.6-> float(14680063)
151...with precision 2.1e1-> float(14680063)
152...with precision 1-> float(14680063)
153...with precision -> float(14680063)
154round: 1.234567
155...with precision 2-> float(1.23)
156...with precision 8-> float(1.234567)
157...with precision 3-> float(1.235)
158...with precision 4-> float(1.2346)
159
160Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d
161...with precision 3.6-> float(1.235)
162...with precision 2-> float(1.23)
163...with precision 04-> float(1.2346)
164
165Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
166...with precision 3.6-> float(1.235)
167...with precision 2.1e1-> float(1.234567)
168...with precision 1-> float(1.2)
169...with precision -> float(1)
170round: 2.3456789e8
171...with precision 2-> float(234567890)
172...with precision 8-> float(234567890)
173...with precision 3-> float(234567890)
174...with precision 4-> float(234567890)
175
176Deprecated: Implicit conversion from float 3.6 to int loses precision in %s on line %d
177...with precision 3.6-> float(234567890)
178...with precision 2-> float(234567890)
179...with precision 04-> float(234567890)
180
181Deprecated: Implicit conversion from float-string "3.6" to int loses precision in %s on line %d
182...with precision 3.6-> float(234567890)
183...with precision 2.1e1-> float(234567890)
184...with precision 1-> float(234567890)
185...with precision -> float(234567890)
186