Improve C++-ness, eliminate some macros

- fm_exp moved to math_special (exp2 was already there)
- use std::min/max template instead of macros
- use memory->create for dynamic arrays (still 1-indexed with macro)
- remove _ from function names, adjust method visibility
This commit is contained in:
Sebastian Hütter
2017-06-11 16:55:41 +02:00
parent fea28d8028
commit 9f852f5f58
12 changed files with 154 additions and 275 deletions

View File

@ -508,6 +508,9 @@ static const double fm_exp2_p[] = {
1.51390680115615096133e3
};
/* double precision constants */
#define FM_DOUBLE_LOG2OFE 1.4426950408889634074
double MathSpecial::exp2_x86(double x)
{
double ipart, fpart, px, qx;
@ -531,3 +534,14 @@ double MathSpecial::exp2_x86(double x)
x = 1.0 + 2.0*(px/(qx-px));
return epart.f*x;
}
double MathSpecial::fm_exp(double x)
{
#if defined(__BYTE_ORDER__)
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
return exp2_x86(FM_DOUBLE_LOG2OFE * x);
#endif
#endif
return ::exp(x);
}