summaryrefslogtreecommitdiff
path: root/indra/llmath/llmath.h
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2014-05-13 10:02:26 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2014-05-13 10:02:26 -0400
commit7b9708a2e3aede6faef04bd546c497dc68264f58 (patch)
treec49b3779d7a1f2e94fa1d33396c882e3351a4797 /indra/llmath/llmath.h
parentd0eb9658f2698b9c200991e84c1a60be48788e2c (diff)
parentd0ef02c23a7a37c8c9bfe3a86bae88bb811fc9fe (diff)
sunshine-external merge WIP
Diffstat (limited to 'indra/llmath/llmath.h')
-rwxr-xr-xindra/llmath/llmath.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h
index b93f89d674..29db799154 100755
--- a/indra/llmath/llmath.h
+++ b/indra/llmath/llmath.h
@@ -30,6 +30,7 @@
#include <cmath>
#include <cstdlib>
#include <vector>
+#include <limits>
#include "lldefs.h"
//#include "llstl.h" // *TODO: Remove when LLString is gone
//#include "llstring.h" // *TODO: Remove when LLString is gone
@@ -75,6 +76,8 @@ const F32 OO_SQRT2 = 0.7071067811865475244008443621049f;
const F32 DEG_TO_RAD = 0.017453292519943295769236907684886f;
const F32 RAD_TO_DEG = 57.295779513082320876798154814105f;
const F32 F_APPROXIMATELY_ZERO = 0.00001f;
+const F32 F_LN10 = 2.3025850929940456840179914546844f;
+const F32 OO_LN10 = 0.43429448190325182765112891891661;
const F32 F_LN2 = 0.69314718056f;
const F32 OO_LN2 = 1.4426950408889634073599246810019f;
@@ -111,6 +114,12 @@ inline bool is_approx_zero( F32 f ) { return (-F_APPROXIMATELY_ZERO < f) && (f <
// WARNING: Infinity is comparable with F32_MAX and negative
// infinity is comparable with F32_MIN
+// handles negative and positive zeros
+inline bool is_zero(F32 x)
+{
+ return (*(U32*)(&x) & 0x7fffffff) == 0;
+}
+
inline bool is_approx_equal(F32 x, F32 y)
{
const S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02;