aboutsummaryrefslogtreecommitdiff
path: root/math/math_errf.c
diff options
context:
space:
mode:
authorPierre Blanchard <pierre.blanchard@arm.com>2020-10-29 15:50:19 +0000
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2020-10-29 16:36:28 +0000
commit1a79237df2fc1020ccce8528ed54977681302752 (patch)
treeecc2bbb51711e7cd12e36658e9f3c47d401b8139 /math/math_errf.c
parent0f4ae0c5b561de25acb10130fd5e473ec038f89d (diff)
downloadarm-optimized-routines-1a79237df2fc1020ccce8528ed54977681302752.tar.gz
math: add scalar erff.
In round-to-nearest mode the maximum error is 1.09 ULP. Compared to glibc-2.28 erff: throughput is about 2.2x better, latency is about 1.5x better on some AArch64 cores (on random input in [-4,4]). There are further optimization and quality improvement opportunities.
Diffstat (limited to 'math/math_errf.c')
-rw-r--r--math/math_errf.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/math/math_errf.c b/math/math_errf.c
index 07154c5..771d982 100644
--- a/math/math_errf.c
+++ b/math/math_errf.c
@@ -64,3 +64,17 @@ __math_invalidf (float x)
float y = (x - x) / (x - x);
return isnan (x) ? y : with_errnof (y, EDOM);
}
+
+/* Check result and set errno if necessary. */
+
+HIDDEN float
+__math_check_uflowf (float y)
+{
+ return y == 0.0f ? with_errnof (y, ERANGE) : y;
+}
+
+HIDDEN float
+__math_check_oflowf (float y)
+{
+ return isinf (y) ? with_errnof (y, ERANGE) : y;
+}