From 1a79237df2fc1020ccce8528ed54977681302752 Mon Sep 17 00:00:00 2001 From: Pierre Blanchard Date: Thu, 29 Oct 2020 15:50:19 +0000 Subject: 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. --- math/math_errf.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'math/math_errf.c') 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; +} -- cgit v1.2.3