aboutsummaryrefslogtreecommitdiffstats
path: root/code/qcommon/q_math.c
diff options
context:
space:
mode:
Diffstat (limited to 'code/qcommon/q_math.c')
-rw-r--r--code/qcommon/q_math.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/code/qcommon/q_math.c b/code/qcommon/q_math.c
index de90b8b..5ddd81f 100644
--- a/code/qcommon/q_math.c
+++ b/code/qcommon/q_math.c
@@ -1252,4 +1252,24 @@ void PerpendicularVector( vec3_t dst, const vec3_t src )
VectorNormalize( dst );
}
+/*
+================
+Q_isnan
+Don't pass doubles to this
+================
+*/
+int Q_isnan( float x )
+{
+ union
+ {
+ float f;
+ unsigned int i;
+ } t;
+
+ t.f = x;
+ t.i &= 0x7FFFFFFF;
+ t.i = 0x7F800000 - t.i;
+
+ return (int)( (unsigned int)t.i >> 31 );
+}