From 701ba39cdc519ceace31831bbbc250e452d1b2e1 Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Mon, 9 Aug 2021 01:33:48 +0200 Subject: [PATCH] Added Atan2{,32}. --- math.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/math.go b/math.go index 6f15631..157a57c 100644 --- a/math.go +++ b/math.go @@ -19,16 +19,26 @@ func Abs32(f float32) float32 { return float32(Abs(float64(f))) } -// Atan returns the arctangent of f. +// Atan returns the arc tangent of f. func Atan(f float64) float64 { return math.Atan(f) } -// Atan32 returns the arctangent of f. +// Atan2 returns the arc tangent of y/x. +func Atan2(y, x float64) float64 { + return math.Atan2(y, x) +} + +// Atan32 returns the arc tangent of f. func Atan32(f float32) float32 { return float32(math.Atan(float64(f))) } +// Atan232 returns the arc tangent of y/x. +func Atan232(y, x float32) float32 { + return float32(math.Atan2(float64(y), float64(x))) +} + // Ceil rounds f up to an natural number. func Ceil(f float64) float64 { return math.Ceil(f)