From 85bee436401a3bd02c01a7dc8d9a445feece0028 Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Sun, 29 Dec 2019 15:45:50 +0100 Subject: [PATCH] Added Atan{,32}, Cos{,32}, Sin{,32}, Tan{,32}. --- math.go | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/math.go b/math.go index 520a101..5b8216e 100644 --- a/math.go +++ b/math.go @@ -12,6 +12,26 @@ func Abs32(f float32) float32 { return float32(Abs(float64(f))) } +// Atan returns the arctangent of f. +func Atan(f float64) float64 { + return math.Atan(f) +} + +// Atan32 returns the arctangent of f. +func Atan32(f float32) float32 { + return float32(math.Atan(float64(f))) +} + +// Cos returns the cosine of f. +func Cos(f float64) float64 { + return math.Cos(f) +} + +// Cos32 returns the cosine of f. +func Cos32(f float32) float32 { + return float32(math.Cos(float64(f))) +} + // IsNaN checks if the floating point number is not a number. func IsNaN(f float64) bool { return f != f @@ -62,6 +82,16 @@ func Round32(f float32) float32 { return float32(math.Round(float64(f))) } +// Sin returns the sine of f. +func Sin(f float64) float64 { + return math.Sin(f) +} + +// Sin32 returns the sine of f. +func Sin32(f float32) float32 { + return float32(math.Sin(float64(f))) +} + // Sq returns the squared value of f. func Sq(f float64) float64 { return f * f @@ -81,3 +111,13 @@ func Sqrt(f float64) float64 { func Sqrt32(f float32) float32 { return float32(Sqrt(float64(f))) } + +// Tan returns the tangent of f. +func Tan(f float64) float64 { + return math.Tan(f) +} + +// Tan32 returns the tangent of f. +func Tan32(f float32) float32 { + return float32(math.Tan(float64(f))) +}