Revision: 53791
          http://brlcad.svn.sourceforge.net/brlcad/?rev=53791&view=rev
Author:   brlcad
Date:     2012-11-21 04:55:40 +0000 (Wed, 21 Nov 2012)
Log Message:
-----------
rearrange the ancient INFINITY constants to use available platform-defined 
limits that usually represent infinity.  fall back to what we were doing if all 
else fails, but it should increase our modeling range to the extent available 
for fastf_t.

Modified Paths:
--------------
    brlcad/trunk/include/bu.h

Modified: brlcad/trunk/include/bu.h
===================================================================
--- brlcad/trunk/include/bu.h   2012-11-21 04:42:06 UTC (rev 53790)
+++ brlcad/trunk/include/bu.h   2012-11-21 04:55:40 UTC (rev 53791)
@@ -1231,23 +1231,31 @@
 /** DEPRECATED, do not use */
 #define SMALL SQRT_SMALL_FASTF
 
+
 /**
- * It is necessary to have a representation of 1.0/0.0, or "infinity"
- * that fits within the dynamic range of the machine being used.  This
- * constant places an upper bound on the size object which can be
- * represented in the model.
+ * It is necessary to have a representation of 1.0/0.0 or log(0),
+ * i.e., "infinity" that fits within the dynamic range of the machine
+ * being used.  This constant places an upper bound on the size object
+ * which can be represented in the model.  With IEEE 754 floating
+ * point, this may print as 'inf' and is represented with all 1 bits
+ * in the biased-exponent field and all 0 bits in the fraction with
+ * the sign indicating positive (0) or negative (1) infinity.
  */
-#ifdef INFINITY
-#    undef INFINITY
+#ifndef INFINITY
+#  if defined(HUGE_VALF)
+#    define INFINITY ((fastf_t)HUGE_VALF)
+#  elif defined(HUGE_VAL)
+#    define INFINITY ((fastf_t)HUGE_VAL)
+#  elif defined(HUGE)
+#    define INFINITY ((fastf_t)HUGE)
+#  elif defined(MAXFLOAT)
+#    define INFINITY ((fastf_t)MAXFLOAT)
+#  else
+#    define INFINITY ((fastf_t)1.0e40)
+#  endif
 #endif
 
-#if defined(vax)
-#    define INFINITY   (1.0e20)        /* VAX limit is 10**37 */
-#else
-#    define INFINITY   (1.0e40)        /* IBM limit is 10**75 */
-#endif
 
-
 /*----------------------------------------------------------------------*/
 /** @addtogroup bitv */
 /** @ingroup container */

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to