From 3e37d81f1dca750979798e9e0b3c35f6dbed1481 Mon Sep 17 00:00:00 2001
From: Tim Moore <timoore@redhat.com>
Date: Fri, 6 Feb 2009 15:44:07 +0100
Subject: [PATCH] HUD::Tape: avoid floating point exception

---
 src/Instrumentation/HUD/HUD_tape.cxx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/Instrumentation/HUD/HUD_tape.cxx b/src/Instrumentation/HUD/HUD_tape.cxx
index db9e68fef..89c4ceae9 100644
--- a/src/Instrumentation/HUD/HUD_tape.cxx
+++ b/src/Instrumentation/HUD/HUD_tape.cxx
@@ -64,7 +64,9 @@ HUD::Tape::Tape(HUD *hud, const SGPropertyNode *n, float x, float y) :
         _div_ratio = 0, _minor_divs = _major_divs;
 
 //    int k; //odd or even values for ticks		// FIXME odd scale
-    _odd_type = int(floorf(_input.max() + 0.5)) & 1 ? true : false;
+    _odd_type = false;
+    if (_input.max() + .5f < float(SGLimits<long>::max()))
+        _odd_type = long(floorf(_input.max() + 0.5f)) & 1 ? true : false;
 }