From 90366f9dd1d59dfc3abb7368410b9225da55240a Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Sun, 26 Nov 2017 23:18:11 +0000 Subject: [PATCH] style fixes --- src/PhpSpreadsheet/Calculation/MathTrig.php | 10 ++-------- tests/data/Calculation/MathTrig/GCD.php | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/PhpSpreadsheet/Calculation/MathTrig.php b/src/PhpSpreadsheet/Calculation/MathTrig.php index 0e2a00ef..04bc0616 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig.php @@ -312,14 +312,8 @@ class MathTrig return Functions::VALUE(); } - public static function evaluateGCD($a, $b) { - // As we're just working with two values, we can use the recursive Euclidian method - // If we were working with more than two values, we need to extend as - // gcd(gcd(a, b), c) - // to encompass all the values we need to evaluate - // The method we're using is limited to integers, if we wanted to support floats as well - // then we'd need something like: - // return $b > .000000000001 ? gcd($b, fmod($a, $b)) : $a; + public static function evaluateGCD($a, $b) + { return $b ? self::evaluateGCD($b, $a % $b) : $a; } diff --git a/tests/data/Calculation/MathTrig/GCD.php b/tests/data/Calculation/MathTrig/GCD.php index 7a45947a..e4b25d37 100644 --- a/tests/data/Calculation/MathTrig/GCD.php +++ b/tests/data/Calculation/MathTrig/GCD.php @@ -113,7 +113,7 @@ return [ 0, 0, ], - [ + [ 2, 10.5, 2.6, @@ -125,7 +125,7 @@ return [ ], [ 13, - 182, + 182, 481, 143, ],