path: root/dist
diff options
authorSzabolcs Nagy <>2013-05-19 12:13:08 +0000
committerSzabolcs Nagy <>2013-05-19 12:13:08 +0000
commitffd8ac2dd50f99c3c83d7d9d845df9874ec3e7d5 (patch)
tree66808745c008d12935d2e46637457f623c547b22 /dist
parent83af1dd65a11f3da3f99ba861248a841c402ccaa (diff)
math: fix two fma issues (only affects non-nearest rounding mode, x86)
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
Diffstat (limited to 'dist')
0 files changed, 0 insertions, 0 deletions