diff options
author | Pierre Blanchard <pierre.blanchard@arm.com> | 2020-11-05 16:26:36 +0000 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2020-11-13 14:43:49 +0000 |
commit | 00e5afdbaf600cb8d56072685e987800d8678248 (patch) | |
tree | 312326613eb7e581fdf0e17766d48cf01d40da65 /math/test | |
parent | fc3fcc91ba7d79b30876d8e7ee68b8442a50da5c (diff) | |
download | arm-optimized-routines-00e5afdbaf600cb8d56072685e987800d8678248.tar.gz |
math: add scalar erf
Only tested in round-to-nearest mode. The expected worst case error
is 1.01 ULP near x=1.25. Benchmarked over random x in [-6,6] and
can increase performance by > 2x (> 3.5x for throughput) on big ooo
cores compared to the implementation in glibc 2.28.
Includes data for erfc too, but this patch only adds erf.
Diffstat (limited to 'math/test')
-rw-r--r-- | math/test/mathbench.c | 1 | ||||
-rwxr-xr-x | math/test/runulp.sh | 8 | ||||
-rw-r--r-- | math/test/testcases/directed/erf.tst | 17 | ||||
-rw-r--r-- | math/test/ulp.c | 1 |
4 files changed, 27 insertions, 0 deletions
diff --git a/math/test/mathbench.c b/math/test/mathbench.c index 2bca52b..2e8aaf8 100644 --- a/math/test/mathbench.c +++ b/math/test/mathbench.c @@ -248,6 +248,7 @@ D (log2, 0.999, 1.001) {"pow", 'd', 0, 0.01, 11.1, {.d = xypow}}, D (xpow, 0.01, 11.1) D (ypow, -9.9, 9.9) +D (erf, -6.0, 6.0) F (dummyf, 1.0, 2.0) F (expf, -9.9, 9.9) diff --git a/math/test/runulp.sh b/math/test/runulp.sh index 283145e..492a6f2 100755 --- a/math/test/runulp.sh +++ b/math/test/runulp.sh @@ -72,6 +72,14 @@ t pow 0x1.ffffffffffff0p-1 0x1.0000000000008p0 x 0x1p60 0x1p68 50000 t pow 0x1.ffffffffff000p-1 0x1p0 x 0x1p50 0x1p52 50000 t pow -0x1.ffffffffff000p-1 -0x1p0 x 0x1p50 0x1p52 50000 +L=1.0 +t erf 0 0xffff000000000000 10000 +t erf 0x1p-1022 0x1p-26 40000 +t erf -0x1p-1022 -0x1p-26 40000 +t erf 0x1p-26 0x1p3 40000 +t erf -0x1p-26 -0x1p3 40000 +t erf 0 inf 40000 + L=0.01 t expf 0 0xffff0000 10000 t expf 0x1p-14 0x1p8 50000 diff --git a/math/test/testcases/directed/erf.tst b/math/test/testcases/directed/erf.tst new file mode 100644 index 0000000..7fa4d18 --- /dev/null +++ b/math/test/testcases/directed/erf.tst @@ -0,0 +1,17 @@ +; erf.tst - Directed test cases for erf +; +; Copyright (c) 2007-2020, Arm Limited. +; SPDX-License-Identifier: MIT + +func=erf op1=7ff80000.00000001 result=7ff80000.00000001 errno=0 +func=erf op1=fff80000.00000001 result=7ff80000.00000001 errno=0 +func=erf op1=7ff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=erf op1=fff00000.00000001 result=7ff80000.00000001 errno=0 status=i +func=erf op1=7ff00000.00000000 result=3ff00000.00000000 errno=0 +func=erf op1=fff00000.00000000 result=bff00000.00000000 errno=0 +func=erf op1=00000000.00000000 result=00000000.00000000 errno=ERANGE +func=erf op1=80000000.00000000 result=80000000.00000000 errno=ERANGE +func=erf op1=00000000.00000001 result=00000000.00000001 errno=0 status=ux +func=erf op1=80000000.00000001 result=80000000.00000001 errno=0 status=ux +func=erf op1=3ff00000.00000000 result=3feaf767.a741088a.c6d errno=0 +func=erf op1=bff00000.00000000 result=bfeaf767.a741088a.c6d errno=0 diff --git a/math/test/ulp.c b/math/test/ulp.c index 3701c93..05a5321 100644 --- a/math/test/ulp.c +++ b/math/test/ulp.c @@ -337,6 +337,7 @@ static const struct fun fun[] = { D1 (log) D1 (log2) D2 (pow) + D1 (erf) #if WANT_VMATH F (__s_sinf, __s_sinf, sin, mpfr_sin, 1, 1, f1, 0) F (__s_cosf, __s_cosf, cos, mpfr_cos, 1, 1, f1, 0) |