[libc-commits] [PATCH] D123154: [libc] Implement sinf function that is correctly rounded to all rounding modes.

Santosh Nagarakatte via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Jul 20 19:28:25 PDT 2022


santoshn added inline comments.


================
Comment at: libc/src/math/generic/range_reduction.h:33-40
+static constexpr double ONE_OVER_PI_28[N_ENTRIES] = {
+    0x1.45f306ep-2,   -0x1.b1bbeaep-33,  0x1.3f84ebp-62,    -0x1.7056592p-92,
+    0x1.c0db62ap-121, -0x1.4cd8778p-150, -0x1.bef806cp-179, 0x1.63abdecp-209};
+
+// Exponents of the least significant bits of the corresponding entries in
+// ONE_OVER_PI_28.
+static constexpr int ONE_OVER_PI_28_LSB_EXP[N_ENTRIES] = {
----------------
I was reviewing this code. I am not able to understand how ONE_OVER_PI_28_LSB_EXP[2] == -86.  The third entry in ONE_OVER_PI_28 (i.e., 0x1.3f84ebp-62)  has an exponent of -62 and there are 27 fraction bits. So the exponent of the LSB should be -89.

 Similarly  ONE_OVER_PI_28_LSB_EXP[5] is -167?

Similarly ONE_OVER_PI_28_LSB_EXP[6] is -206?

Similarly ONE_OVER_PI_28_LSB_EXP[7] is -236?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123154



More information about the libc-commits mailing list