[libc-commits] [PATCH] D132809: [libc][math] Added auxiliary function log2_eval for asinhf/acoshf/atanhf.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Aug 29 13:03:23 PDT 2022


lntue added inline comments.


================
Comment at: libc/src/math/generic/supfuncf.cpp:28
+
+alignas(64) const double LOG_P1_LOG2[LOG_P1_SIZE] = {
+    0x0.0000000000000p+0, 0x1.6e79685c2d22ap-6, 0x1.6bad3758efd87p-5,
----------------
Add comments about how these constants are defined and generated.  The same for other tables below.


================
Comment at: libc/src/math/generic/supfuncf.h:9
 
-#ifndef LLVM_LIBC_SRC_MATH_GENERIC_EXPXF_H
-#define LLVM_LIBC_SRC_MATH_GENERIC_EXPXF_H
+#ifndef LLVM_LIBC_SRC_MATH_GENERIC_EXPLOGXF_H
+#define LLVM_LIBC_SRC_MATH_GENERIC_EXPLOGXF_H
----------------
`explogxf.h` is a better name for this file and cmake target.


================
Comment at: libc/src/math/generic/supfuncf.h:110
+  double pe = fputil::polyeval(
+      dx, 1.0, 0x1.62e42fefa39efp-1, 0x1.ebfbdff82c58fp-3, 0x1.c6b08d704a0c0p-5,
+      0x1.3b2ab6fba4e77p-7, 0x1.5d87fe78a6731p-10, 0x1.430912f86c787p-13);
----------------
Add comments about how the coefficients are generated.


================
Comment at: libc/src/math/generic/supfuncf.h:137
+
+  double c0 = fputil::multiply_add(dx, 0x1.71547652b82fep+0, LOG_P1_LOG2[p1]);
+  result += __llvm_libc::fputil::polyeval(dx * dx, c0, c1, c2, c3, c4);
----------------
Add comment about what the constant is and how it is generated.


================
Comment at: libc/src/math/generic/supfuncf.h:144
+inline static double log_eval(double x) {
+  return log2_eval(x) * 0x1.62e42fefa39efp-1;
+}
----------------
Add comment about what the constant is and how it is generated.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132809/new/

https://reviews.llvm.org/D132809



More information about the libc-commits mailing list