From e7df016af33408756c7f6ead0b9ab111c7902a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Peyronnet?= Date: Sun, 8 May 2022 09:50:15 +0200 Subject: [PATCH] Added the possibility to get the positive of a number (#318) --- LeoCorpLibrary/Maths.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LeoCorpLibrary/Maths.cs b/LeoCorpLibrary/Maths.cs index 8643c58..3c62191 100644 --- a/LeoCorpLibrary/Maths.cs +++ b/LeoCorpLibrary/Maths.cs @@ -117,6 +117,8 @@ public static double DegreesToRadians(double degrees) /// If 10 is specified, the method will return -10. public static double GetOpposite(double n) => 0 - n; + public static double GetPositive(double n) => n >= 0 ? n : -n; + /// /// Returns the factorial of a specified number.