diff options
Diffstat (limited to 'src/qcommon/q_math.c')
-rw-r--r-- | src/qcommon/q_math.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/qcommon/q_math.c b/src/qcommon/q_math.c index bf209562..196d2f55 100644 --- a/src/qcommon/q_math.c +++ b/src/qcommon/q_math.c @@ -1538,3 +1538,25 @@ vec_t DistanceBetweenLineSegments( return (vec_t)sqrt( DistanceBetweenLineSegmentsSquared( sP0, sP1, tP0, tP1, s, t ) ); } + +/* +================= +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 ); +} |