From 74d163b51bb1152a09130c03feff67c1ab625277 Mon Sep 17 00:00:00 2001
From: ehofman <ehofman>
Date: Fri, 23 Jan 2004 18:27:55 +0000
Subject: [PATCH] Rather define our own truncf implementation for BSD alikes

---
 src/Cockpit/panel.cxx | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/Cockpit/panel.cxx b/src/Cockpit/panel.cxx
index 63185884c..7a26ead05 100644
--- a/src/Cockpit/panel.cxx
+++ b/src/Cockpit/panel.cxx
@@ -53,6 +53,12 @@
 // my hardware/driver requires many more.
 #define POFF_UNITS 4
 
+#ifdef __FreeBSD__	// no truncf on FreeBSD
+inline float truncf (float d) {
+    return (d < 0) ? -floorf(-d) : floorf(d);
+}
+#endif
+
 
 ////////////////////////////////////////////////////////////////////////
 // Local functions.
@@ -1119,7 +1125,7 @@ FGTextLayer::Chunk::getValue () const
       break;
     case DOUBLE_VALUE:
       double d = _offs + _node->getFloatValue() * _mult;
-      if (_trunc)  d = floorf(d);
+      if (_trunc)  d = truncf(d);
       sprintf(_buf, _fmt.c_str(), d);
       break;
     }