[libc][math] Update range reduction step for logf and reduce its latency.
commitbc8e87ef4ae94323fdb17e9c916d3e491d82b215
authorTue Ly <lntue@google.com>
Fri, 7 Apr 2023 01:45:45 +0000 (6 21:45 -0400)
committerTue Ly <lntue@google.com>
Mon, 10 Apr 2023 17:00:37 +0000 (10 13:00 -0400)
tree238e6325eb32e778d3d2f191bffd37bc3862ae0e
parent26f1770e538ece427d5069b897f9e686746797a8
[libc][math] Update range reduction step for logf and reduce its latency.

Simplify the range reduction steps by choosing the reduction constants
carefully so that the reduced arguments v = r*m_x - 1 and v^2 are exact in double
precision, even without FMA instructions, and -2^-8 <= v < 2^-7. This allows the
polynomial evaluations to be parallelized more efficiently.

Reviewed By: santoshn, zimmermann6

Differential Revision: https://reviews.llvm.org/D147755
libc/src/math/generic/common_constants.cpp
libc/src/math/generic/common_constants.h
libc/src/math/generic/logf.cpp
libc/test/src/math/logf_test.cpp