Skip to content

Commit ec51b75

Browse files
Mrand of zero to any multiple should return 0 (#1773)
1 parent d2edab2 commit ec51b75

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/PhpSpreadsheet/Calculation/MathTrig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ public static function MROUND($number, $multiple)
851851
$multiple = Functions::flattenSingleValue($multiple);
852852

853853
if ((is_numeric($number)) && (is_numeric($multiple))) {
854-
if ($multiple == 0) {
854+
if ($number == 0 || $multiple == 0) {
855855
return 0;
856856
}
857857
if ((self::SIGN($number)) == (self::SIGN($multiple))) {

tests/data/Calculation/MathTrig/MROUND.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@
4141
31415.92654,
4242
1,
4343
],
44+
[
45+
0,
46+
0,
47+
5,
48+
],
4449
[
4550
'#NUM!',
4651
5,

0 commit comments

Comments
 (0)