[libc-commits] [libc] [libc][math] Improve the error analysis and accuracy for pow function. (PR #102098)
via libc-commits
libc-commits at lists.llvm.org
Tue Aug 6 09:25:01 PDT 2024
================
@@ -358,42 +358,63 @@ LLVM_LIBC_FUNCTION(double, pow, (double x, double y)) {
// Then m_x = (1 + dx) / r, and
// log2(m_x) = log2( (1 + dx) / r )
// = log2(1 + dx) - log2(r).
- // Perform exact range reduction
+
+ // In order for the overall computations x^y = 2^(y * log2(x)) to has relative
+ // errors < 2^-52 (1ULP), we will need evaluate the exponent part y * log2(x)
+ // with absolute errors < 2^52 (or better, 2^-53). Since the whole exponent
+ // range for double precision is bounded by |y * log2(x)| < 1076 ~ 2^10, we
+ // need to evaluate log2(x) with absolute errors < 2^-53 * 2^-10 = 2^-63.
----------------
lntue wrote:
Done.
https://github.com/llvm/llvm-project/pull/102098
More information about the libc-commits
mailing list