29 #include "../precompiled.h"
33 const float idMath::PI = 3.14159265358979323846f;
37 const float idMath::E = 2.71828182845904523536f;
62 fo.
f = (
float)( 1.0 / sqrt( fi.
f ) );
77 int i, sign, exponent, mantissa,
value;
79 assert( exponentBits >= 2 && exponentBits <= 8 );
80 assert( mantissaBits >= 2 && mantissaBits <= 23 );
82 int maxBits = ( ( ( 1 << ( exponentBits - 1 ) ) - 1 ) << mantissaBits ) | ( ( 1 << mantissaBits ) - 1 );
83 int minBits = ( ( ( 1 << exponentBits ) - 2 ) << mantissaBits ) | 1;
91 }
else if ( f <= min ) {
96 return ( maxBits | ( 1 << ( exponentBits + mantissaBits ) ) );
97 }
else if ( f >= -min ) {
98 return ( minBits | ( 1 << ( exponentBits + mantissaBits ) ) );
103 i = *
reinterpret_cast<int *
>(&
f);
107 value = sign << ( 1 + exponentBits + mantissaBits );
108 value |= ( (
INTSIGNBITSET( exponent ) << exponentBits ) | ( abs( exponent ) & ( ( 1 << exponentBits ) - 1 ) ) ) << mantissaBits;
119 static int exponentSign[2] = { 1, -1 };
120 int sign, exponent, mantissa,
value;
122 assert( exponentBits >= 2 && exponentBits <= 8 );
123 assert( mantissaBits >= 2 && mantissaBits <= 23 );
126 sign = i >> ( 1 + exponentBits + mantissaBits );
127 exponent = ( ( i >> mantissaBits ) & ( ( 1 << exponentBits ) - 1 ) ) * exponentSign[( i >> ( exponentBits + mantissaBits ) ) & 1];
130 return *
reinterpret_cast<float *
>(&
value);
static const float INFINITY
GLsizei const GLfloat * value
static const float SQRT_TWO
assert(prefInfo.fullscreenBtn)
#define IEEE_FLT_EXPONENT_BIAS
static const float SQRT_THREE
static const float ONEFOURTH_PI
static const float FLT_EPSILON
#define IEEE_FLT_SIGN_BIT
static const float M_DEG2RAD
static const float HALF_PI
static const float M_SEC2MS
static float BitsToFloat(int i, int exponentBits, int mantissaBits)
static const float M_RAD2DEG
static const float SQRT_1OVER2
static const float TWO_PI
#define IEEE_FLT_EXPONENT_BITS
#define IEEE_FLT_MANTISSA_BITS
static dword iSqrt[SQRT_TABLE_SIZE]
static const float SQRT_1OVER3
static const float M_MS2SEC
static int FloatToBits(float f, int exponentBits, int mantissaBits)