Skip to content

Commit ad16e96

Browse files
committed
fixup! [libc][math][c23] Add exp10m1f C23 math function
Fix left shift of negative values.
1 parent cda46fe commit ad16e96

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libc/src/math/generic/explogxf.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@ template <class Base> LIBC_INLINE exp_b_reduc_t exp_b_range_reduc(float x) {
159159
int k = static_cast<int>(kd);
160160
// hi = floor(kd * 2^(-MID_BITS))
161161
// exp_hi = shift hi to the exponent field of double precision.
162-
int64_t exp_hi = static_cast<int64_t>((k >> Base::MID_BITS))
163-
<< fputil::FPBits<double>::FRACTION_LEN;
162+
uint64_t exp_hi = static_cast<uint64_t>(k >> Base::MID_BITS)
163+
<< fputil::FPBits<double>::FRACTION_LEN;
164164
// mh = 2^hi * 2^mid
165165
// mh_bits = bit field of mh
166-
int64_t mh_bits = Base::EXP_2_MID[k & Base::MID_MASK] + exp_hi;
167-
double mh = fputil::FPBits<double>(uint64_t(mh_bits)).get_val();
166+
uint64_t mh_bits = Base::EXP_2_MID[k & Base::MID_MASK] + exp_hi;
167+
double mh = fputil::FPBits<double>(mh_bits).get_val();
168168
// dx = lo = x - (hi + mid) * log(2)
169169
double dx = fputil::multiply_add(
170170
kd, Base::M_LOGB_2_LO, fputil::multiply_add(kd, Base::M_LOGB_2_HI, xd));

0 commit comments

Comments
 (0)