From 79ef949e170649f0c6298855bb22c0c6e4adb747 Mon Sep 17 00:00:00 2001
From: ehofman <ehofman>
Date: Mon, 19 Jan 2004 14:26:24 +0000
Subject: [PATCH] Check for less than -1.0 also.

---
 src/Time/sunpos.cxx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/Time/sunpos.cxx b/src/Time/sunpos.cxx
index 0b1e03f59..3a190d103 100644
--- a/src/Time/sunpos.cxx
+++ b/src/Time/sunpos.cxx
@@ -341,11 +341,16 @@ void fgUpdateSunPos( void ) {
     dot = sgScalarProductVec3( surface_to_sun, v->get_surface_south() );
     // cout << "  Dot product = " << dot << endl;
 
-    if (dot > 1) {
+    if (dot > 1.0) {
         SG_LOG( SG_ASTRO, SG_WARN,
                 "Dot product  = " << dot << " is greater than 1.0" );
         dot = 1.0;
     }
+    else if (dot < -1.0) {
+         SG_LOG( SG_ASTRO, SG_WARN,
+                 "Dot product  = " << dot << " is less than -1.0" );
+         dot = -1.0;
+     }
 
     if ( east_dot >= 0 ) {
 	l->set_sun_rotation( acos(dot) );