1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix round() tests for different modes (#12049)

* Fix tests round() with different modes

* Fix test results for  round() with different modes
This commit is contained in:
Jorg Adam Sowa
2023-08-26 11:16:00 +02:00
committed by GitHub
parent 81faab9235
commit 58ae26a2a7

View File

@@ -31,7 +31,7 @@ foreach ($modes as $modeKey => $mode) {
foreach ($precisions as $precision) {
echo "\tprecision: $precision\n";
foreach ($numbers as $number) {
$result = round($number, $precision);
$result = round($number, $precision, $mode);
echo "\t\t" .
str_pad($number, 7, " ", STR_PAD_LEFT) .
" => $result\n";
@@ -105,10 +105,10 @@ mode: PHP_ROUND_HALF_UP
mode: PHP_ROUND_HALF_DOWN
precision: 0
2.5 => 3
-2.5 => -3
3.5 => 4
-3.5 => -4
2.5 => 2
-2.5 => -2
3.5 => 3
-3.5 => -3
7 => 7
-7 => -7
0.61 => 1
@@ -166,8 +166,8 @@ mode: PHP_ROUND_HALF_DOWN
mode: PHP_ROUND_HALF_EVEN
precision: 0
2.5 => 3
-2.5 => -3
2.5 => 2
-2.5 => -2
3.5 => 4
-3.5 => -4
7 => 7
@@ -229,8 +229,8 @@ mode: PHP_ROUND_HALF_ODD
precision: 0
2.5 => 3
-2.5 => -3
3.5 => 4
-3.5 => -4
3.5 => 3
-3.5 => -3
7 => 7
-7 => -7
0.61 => 1