1 #ifndef DataFormatsMathAPPROX_EXP_H
2 #define DataFormatsMathAPPROX_EXP_H
49 #ifdef HORNER // HORNER
54 return p01 +
y *
y * p23;
73 #ifdef HORNER // HORNER
79 #else // ESTRIN does seem to save a cycle or two
80 float p56 =
float(0x4.48f41p-8) +
y *
float(0xb.6ad4p-12);
84 float p36 = p34 +
y2 * p56;
85 float p16 = p12 +
y2 * p36;
124 template <
int DEGREE>
137 constexpr
float inv_log2f =
float(0
x1.715476p0);
138 constexpr
float log2H =
float(0xb.172p-4);
139 constexpr
float log2L =
float(0
x1.7f7d1cp-20);
143 float z =
fpfloor((x * inv_log2f) + 0.5
f);
158 float p = approx_expf_P<DEGREE>(y);
162 uint32_t biased_exponent =
e + 127;
163 ef.
ui32 = (biased_exponent << 23);
168 #ifndef NO_APPROX_MATH
170 template <
int DEGREE>
172 return unsafe_expf_impl<DEGREE>(
x);
175 template <
int DEGREE>
177 constexpr
float inf_threshold =
float(0x5.8b90cp4);
179 constexpr
float zero_threshold_ftz = -
float(0x5.75628p4);
184 float r = unsafe_expf<DEGREE>(
x);
190 template <
int DEGREE>
194 template <
int DEGREE>
198 #endif // NO_APPROX_MATH