From b94290850e5b3137c510f22ce2e913c4816ff556 Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Sun, 23 Sep 2018 09:42:08 +0200 Subject: [PATCH] Added Max for floating point numbers. --- math.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/math.go b/math.go index 0d9be4b..5f612d1 100644 --- a/math.go +++ b/math.go @@ -17,7 +17,17 @@ func NaN() float64 { return math.NaN() } -// NaN32 returns not a floating point number. +// NaN32 returns not a floating point number. func NaN32() float32 { return float32(NaN()) } + +// Max the maximum of the two values. +func Max(a, b float64) float64 { + return math.Max(a, b) +} + +// Max32 the maximum of the two values. +func Max32(a, b float32) float32 { + return float32(math.Max(float64(a), float64(b))) +}