[libc-commits] [PATCH] D130629: [libc] Change sinf range reduction to mod pi/16 to be shared with cosf.
Tue Ly via Phabricator via libc-commits
libc-commits at lists.llvm.org
Wed Jul 27 08:47:22 PDT 2022
lntue added inline comments.
Comment at: libc/src/math/generic/range_reduction.h:82
- return static_cast<int64_t>(k_hi + k_lo);
+ return static_cast<int64_t>(k_hi) + static_cast<int64_t>(k_lo);
> From my point of view, this line can be changed to `static_cast<int64_t>(k_hi + k_low)`, because `k_hi` and `k_low` are already "integer", so you can do one static cast instead of two. Probably it can increase performance.
This is actually a must, since there are inputs which makes `k_hi < 2^54` and `k_hi + k_lo > 2^54`, causing rounding errors on the last integral bits due to rounding. If we work it out carefully and adjust a bit, we might be able to avoid these rounding errors. But for simplicity, I went with casting both to int64 in this patch.
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the libc-commits