From 3a89fc251055202ae8a7151871a36eea942b61c2 Mon Sep 17 00:00:00 2001 From: Ferix9288 Date: Wed, 26 Jun 2019 18:49:07 -0700 Subject: [PATCH] fix panic issue if addition of 2 y coordinates is too big for FastCos --- distance.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distance.go b/distance.go index bbf7196..6bc99e6 100644 --- a/distance.go +++ b/distance.go @@ -45,7 +45,7 @@ func FastSine(x float64) float64 { // FastCos calculates cosinus from sinus func FastCos(x float64) float64 { x += math.Pi / 2.0 - if x > math.Pi { + for x > math.Pi { x -= 2 * math.Pi }