Commit cb20cb9f authored by Sebastian Hütter's avatar Sebastian Hütter
Browse files

Add range checks for MathSpecial::fm_exp

parent a231197c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);