From ec51b75fee62aec6d664eda115f08d7849fa0eb9 Mon Sep 17 00:00:00 2001 From: Martins Sipenko Date: Thu, 7 Jan 2021 13:06:26 +0200 Subject: [PATCH] Mrand of zero to any multiple should return 0 (#1773) --- src/PhpSpreadsheet/Calculation/MathTrig.php | 2 +- tests/data/Calculation/MathTrig/MROUND.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/PhpSpreadsheet/Calculation/MathTrig.php b/src/PhpSpreadsheet/Calculation/MathTrig.php index 823f6ef2..b8449b55 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig.php @@ -851,7 +851,7 @@ class MathTrig $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))) { diff --git a/tests/data/Calculation/MathTrig/MROUND.php b/tests/data/Calculation/MathTrig/MROUND.php index 38017b65..71655485 100644 --- a/tests/data/Calculation/MathTrig/MROUND.php +++ b/tests/data/Calculation/MathTrig/MROUND.php @@ -41,6 +41,11 @@ return [ 31415.92654, 1, ], + [ + 0, + 0, + 5, + ], [ '#NUM!', 5,