[libc-commits] [libc] [libc][math] Fix overflow shifts for dyadic floats and add skip accuracy option for expm1. (PR #98048)
via libc-commits
libc-commits at lists.llvm.org
Tue Jul 9 09:05:34 PDT 2024
================
@@ -260,10 +260,19 @@ LIBC_INLINE constexpr DyadicFloat<Bits> quick_add(DyadicFloat<Bits> a,
return a;
// Align exponents
- if (a.exponent > b.exponent)
- b.shift_right(a.exponent - b.exponent);
- else if (b.exponent > a.exponent)
- a.shift_right(b.exponent - a.exponent);
+ if (a.exponent > b.exponent) {
+ size_t shift = static_cast<size_t>(a.exponent - b.exponent);
+ if (shift < Bits)
----------------
lntue wrote:
Done.
https://github.com/llvm/llvm-project/pull/98048
More information about the libc-commits
mailing list