aboutsummaryrefslogtreecommitdiff
path: root/math/erf.c
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2020-11-13 17:09:00 +0000
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2020-11-13 17:22:21 +0000
commit94b4be6009322a584cd3f7b74f22565a162bddfa (patch)
tree649d783fee95bcb7ed810a0b5689a933ad1ff8e9 /math/erf.c
parent15a1d62bf0d6e6069a917b633b5013e36f08e017 (diff)
downloadarm-optimized-routines-94b4be6009322a584cd3f7b74f22565a162bddfa.tar.gz
math: fix spurious underflow in erff and erf
The code relied on the final x + c*x to be done via an fma, otherwise the intermediate c*x could underflow for tiny (almost subnormal) x. Use explicit fmaf like elsewhere (this code is not expected to be fast when fma is not inlined, but at least it should be correct).
Diffstat (limited to 'math/erf.c')
-rw-r--r--math/erf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/math/erf.c b/math/erf.c
index 97b543b..12d7e51 100644
--- a/math/erf.c
+++ b/math/erf.c
@@ -47,7 +47,7 @@ erf (double x)
{ /* a < 2^(-28). */
if (ia < 0x00800000)
{ /* a < 2^(-1015). */
- double y = x + TwoOverSqrtPiMinusOne * x;
+ double y = fma (TwoOverSqrtPiMinusOne, x, x);
return check_uflow (y);
}
return x + TwoOverSqrtPiMinusOne * x;