From 03d6a36e0a6555b0289f6537b2d0337d58bb6fde Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Thu, 3 Oct 2019 08:57:30 +0200 Subject: [PATCH] Add a comment on cosH bounds --- src/sun.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sun.c b/src/sun.c index 1a37daa..630fc97 100644 --- a/src/sun.c +++ b/src/sun.c @@ -55,8 +55,11 @@ static float calcSun(int year, int month, int day, float latitude, (cosDec * cos((M_PI / 180.0f) * latitude)); if (cosH > 1) { + // the sun never rises at this location on the specified date return 0; - } else if (cosH < -1) { + } + if (cosH < -1) { + // the sun never sets at this location on the specified date return 0; }