Add range checks for MathSpecial::fm_exp

This commit is contained in:
Sebastian Hütter 2019-12-17 22:23:19 +01:00
parent a231197c10
commit cb20cb9f25
1 changed files with 2 additions and 0 deletions

View File

@ -538,6 +538,8 @@ double MathSpecial::exp2_x86(double x)
double MathSpecial::fm_exp(double x)
{
#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
if (x < -1022.0/FM_DOUBLE_LOG2OFE) return 0;
if (x > 1023.0/FM_DOUBLE_LOG2OFE) return INFINITY;
return exp2_x86(FM_DOUBLE_LOG2OFE * x);
#else
return ::exp(x);