Skip to content

Commit 58ae26a

Browse files
authored
Fix round() tests for different modes (#12049)
* Fix tests round() with different modes * Fix test results for round() with different modes
1 parent 81faab9 commit 58ae26a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

ext/standard/tests/math/round_modes.phpt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ foreach ($modes as $modeKey => $mode) {
3131
foreach ($precisions as $precision) {
3232
echo "\tprecision: $precision\n";
3333
foreach ($numbers as $number) {
34-
$result = round($number, $precision);
34+
$result = round($number, $precision, $mode);
3535
echo "\t\t" .
3636
str_pad($number, 7, " ", STR_PAD_LEFT) .
3737
" => $result\n";
@@ -105,10 +105,10 @@ mode: PHP_ROUND_HALF_UP
105105

106106
mode: PHP_ROUND_HALF_DOWN
107107
precision: 0
108-
2.5 => 3
109-
-2.5 => -3
110-
3.5 => 4
111-
-3.5 => -4
108+
2.5 => 2
109+
-2.5 => -2
110+
3.5 => 3
111+
-3.5 => -3
112112
7 => 7
113113
-7 => -7
114114
0.61 => 1
@@ -166,8 +166,8 @@ mode: PHP_ROUND_HALF_DOWN
166166

167167
mode: PHP_ROUND_HALF_EVEN
168168
precision: 0
169-
2.5 => 3
170-
-2.5 => -3
169+
2.5 => 2
170+
-2.5 => -2
171171
3.5 => 4
172172
-3.5 => -4
173173
7 => 7
@@ -229,8 +229,8 @@ mode: PHP_ROUND_HALF_ODD
229229
precision: 0
230230
2.5 => 3
231231
-2.5 => -3
232-
3.5 => 4
233-
-3.5 => -4
232+
3.5 => 3
233+
-3.5 => -3
234234
7 => 7
235235
-7 => -7
236236
0.61 => 1

0 commit comments

Comments
 (0)