Skip to content

Commit

Permalink
Mrand of zero to any multiple should return 0 (#1773)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinssipenko committed Jan 7, 2021
1 parent d2edab2 commit ec51b75
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/PhpSpreadsheet/Calculation/MathTrig.php
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ public static function MROUND($number, $multiple)
$multiple = Functions::flattenSingleValue($multiple);

if ((is_numeric($number)) && (is_numeric($multiple))) {
if ($multiple == 0) {
if ($number == 0 || $multiple == 0) {
return 0;
}
if ((self::SIGN($number)) == (self::SIGN($multiple))) {
Expand Down
5 changes: 5 additions & 0 deletions tests/data/Calculation/MathTrig/MROUND.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
31415.92654,
1,
],
[
0,
0,
5,
],
[
'#NUM!',
5,
Expand Down

0 comments on commit ec51b75

Please sign in to comment.