11 static inline float fast_log2 (
float val)
16 union {
float f;
int i;} t;
18 int*
const exp_ptr = &t.i;
20 const int log_2 = ((x >> 23) & 255) - 128;
24 val = ((-1.0f/3) * t.f + 2) * t.f - 2.0f/3;
28 static inline float fast_log (
const float val)
30 return (fast_log2 (val) * 0.69314718f);
33 static inline float fast_log10 (
const float val)
35 return fast_log2(val) / 3.312500f;
38 static inline float minus_infinity() {
return -HUGE_VAL; }