Remove slow paths from log

System Internals / glibc - Wilco Dijkstra [arm.com] - 7 February 2018 12:24 EST

Remove the slow paths from log. Like several other double precision math functions, log is exactly rounded. This is not required from math functions and causes major overheads as it requires multiple fallbacks using higher precision arithmetic if a result is close to 0.5ULP. Ridiculous slowdowns of up to 100000x have been reported when the highest precision path triggers.

Interestingly removing the slow paths makes hardly any difference in practice: the worst case error is still ~0.502ULP, and exp(log(x)) shows identical results before/after on many millions of random cases. All GLIBC math tests pass on AArch64 and x64 with no change in ULP error. A simple test over a few hundred million values shows log is now 18% faster on average.

- manual/probes.texi (slowlog): Delete documentation of removed probe. (slowlog_inexact): Likewise
- sysdeps/ieee754/dbl-64/e_log.c (__ieee754_log): Remove slow paths.
- sysdeps/ieee754/dbl-64/ulog.h: Remove unused declarations.

b7c83ca30e Remove slow paths from log
ChangeLog | 7 +++
manual/probes.texi | 17 ------
sysdeps/ieee754/dbl-64/e_log.c | 127 ++++++-----------------------------------
sysdeps/ieee754/dbl-64/ulog.h | 94 ------------------------------
4 files changed, 23 insertions(+), 222 deletions(-)

Upstream: sourceware.org


  • Share