aboutsummaryrefslogtreecommitdiff
path: root/config.mk.dist
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2019-07-18 10:17:08 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2019-07-18 10:17:08 +0100
commit3a1d8e6f16d21cfda6f33e43a1d1df98a05c4dde (patch)
tree3ad5e8ecfa6bd54f002ec406b462070e70edcd8e /config.mk.dist
parentd1db92e03f96aa905a64ccedc8a826f8d61c9ba1 (diff)
downloadarm-optimized-routines-3a1d8e6f16d21cfda6f33e43a1d1df98a05c4dde.tar.gz
Add simple ULP error check code
Check ULP error by random sampling and comparing against a higher precision implmenetation. This is similar to the randomized tests in the mathtest code, but it runs on the target only and is much faster to allow exhaustive ULP checks for single precision functions. It also supports non-nearest rounding modes. The ULP error is reported in an unconventional way: instead of the difference between the observed rounded result and accurate result, the minimum error is reported that makes the accurate result round to the observed result. This is more useful for comparing errors across different rounding modes. In nearest-rounding mode usually 0.5 has to be added to the reported error to get the conventional ULP error. The code optionally depends on mpfr. On targets where double has the same format as long double, mpfr is required for testing double precision functions. By default there is no dependency on mpfr on the target, to use mpfr add -DUSE_MPFR to the CFLAGS and -lmpfr to LDLIBS. ucheck is a new make target for running ulp error checks. Typical usage and output of the new ulp tool: $ build/bin/ulp -e .001 exp 1.0 2.0 12345 exp(0x1.79ef3658a63c9p+0) got 0x1.181caa32757a7p+2 want 0x1.181caa32757a6p+2 +0.499708 ulp err 0.000291756 exp(0x1.9c8a65340f80cp+0) got 0x1.40a8032e5f576p+2 want 0x1.40a8032e5f575p+2 +0.498903 ulp err 0.00109668 FAIL exp in [0x1p+0;0x1p+1] round n errlim 0.001 maxerr 0.00109668 +0.5 cnt 12345 cnt1 6 0.0486027% cnt2 0 0% cntfail 1 0.00810045% Floating-point exceptions are not guaranteed to be reported accurately and can be turned off by -f. The implementation is generic over the argument types which complicates the code, but at least the difficult inner loop logic is not repeated many times this way. To add support for a new function foo, the fun array needs to be updated with an entry for foo. (This usually requires the functions foo, fool and mpfr_foo to be defined.)
Diffstat (limited to 'config.mk.dist')
-rw-r--r--config.mk.dist6
1 files changed, 5 insertions, 1 deletions
diff --git a/config.mk.dist b/config.mk.dist
index 7cf7393..c549fa4 100644
--- a/config.mk.dist
+++ b/config.mk.dist
@@ -16,7 +16,11 @@ HOST_CFLAGS += -g
CFLAGS += -g
# Use if the target FPU only supports single precision.
-#CFLAGS += WANT_SINGLEPREC
+#CFLAGS += -DWANT_SINGLEPREC
+
+# Use if mpfr is available on the target for ulp error checking.
+#LDLIBS += -lmpfr -lgmp
+#CFLAGS += -DUSE_MPFR
# Use with gcc.
CFLAGS += -frounding-math -fexcess-precision=standard -fno-stack-protector