• S
    math: fix two fma issues (only affects non-nearest rounding mode, x86) · ffd8ac2d
    Szabolcs Nagy 提交于
    1) in downward rounding fma(1,1,-1) should be -0 but it was 0 with
    gcc, the code was correct but gcc does not support FENV_ACCESS ON
    so it used common subexpression elimination where it shouldn't have.
    now volatile memory access is used as a barrier after fesetround.
    
    2) in directed rounding modes there is no double rounding issue
    so the complicated adjustments done for nearest rounding mode are
    not needed. the only exception to this rule is raising the underflow
    flag: assume "small" is an exactly representible subnormal value in
    double precision and "verysmall" is a much smaller value so that
    	(long double)(small plus verysmall) == small
    then
    	(double)(small plus verysmall)
    raises underflow because the result is an inexact subnormal, but
    	(double)(long double)(small plus verysmall)
    does not because small is not a subnormal in long double precision
    and it is exact in double precision.
    now this problem is fixed by checking inexact using fenv when the
    result is subnormal
    ffd8ac2d
fma.c 11.8 KB