From dd6d42a60add9dc43a8136a0da860af12ef9db4b Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Wed, 14 Nov 2018 10:15:53 +0100 Subject: [PATCH] Added Abs{,32}. --- math.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/math.go b/math.go index 5c1346c..43bc996 100644 --- a/math.go +++ b/math.go @@ -2,6 +2,16 @@ package geom import "math" +// Abs returns the absolute value. +func Abs(f float64) float64 { + return math.Abs(f) +} + +// Abs32 returns the absolute value. +func Abs32(f float32) float32 { + return float32(Abs(float64(f))) +} + // IsNaN checks if the floating point number is not a number. func IsNaN(f float64) bool { return f != f