Skip to content

Commit be52592

Browse files
committed
[libc][NFC] Rename MANTISSA_WIDTH in FRACTION_BITS
This one might be a bit controversial since the terminology has been introduced from the start but I think `FRACTION_BITS` is a better name here. AFAICT it really is "the number of bits after the decimal dot when the number is in normal form." Mantissa width is less precise as it's unclear whether we take into account the hidden bit for IEEE754 formats.
1 parent b4fa7f4 commit be52592

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+193
-204
lines changed

libc/src/__support/FPUtil/FPBits.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ template <typename T> struct FPBits : private FloatProperties<T> {
3737
using FloatProperties<T>::EXPONENT_MASK;
3838
using FloatProperties<T>::EXPONENT_BIAS;
3939
using FloatProperties<T>::EXPONENT_WIDTH;
40-
using FloatProperties<T>::MANTISSA_MASK;
41-
using FloatProperties<T>::MANTISSA_WIDTH;
40+
using FloatProperties<T>::FRACTION_MASK;
41+
using FloatProperties<T>::FRACTION_BITS;
4242
using FloatProperties<T>::QUIET_NAN_MASK;
4343
using FloatProperties<T>::SIGN_MASK;
4444

@@ -48,32 +48,32 @@ template <typename T> struct FPBits : private FloatProperties<T> {
4848
UIntType bits;
4949

5050
LIBC_INLINE constexpr void set_mantissa(UIntType mantVal) {
51-
mantVal &= MANTISSA_MASK;
52-
bits &= ~MANTISSA_MASK;
51+
mantVal &= FRACTION_MASK;
52+
bits &= ~FRACTION_MASK;
5353
bits |= mantVal;
5454
}
5555

5656
LIBC_INLINE constexpr UIntType get_mantissa() const {
57-
return bits & MANTISSA_MASK;
57+
return bits & FRACTION_MASK;
5858
}
5959

6060
LIBC_INLINE constexpr void set_biased_exponent(UIntType expVal) {
61-
expVal = (expVal << MANTISSA_WIDTH) & EXPONENT_MASK;
61+
expVal = (expVal << FRACTION_BITS) & EXPONENT_MASK;
6262
bits &= ~EXPONENT_MASK;
6363
bits |= expVal;
6464
}
6565

6666
LIBC_INLINE constexpr uint16_t get_biased_exponent() const {
67-
return uint16_t((bits & EXPONENT_MASK) >> MANTISSA_WIDTH);
67+
return uint16_t((bits & EXPONENT_MASK) >> FRACTION_BITS);
6868
}
6969

7070
// The function return mantissa with the implicit bit set iff the current
7171
// value is a valid normal number.
7272
LIBC_INLINE constexpr UIntType get_explicit_mantissa() {
7373
return ((get_biased_exponent() > 0 && !is_inf_or_nan())
74-
? (MANTISSA_MASK + 1)
74+
? (FRACTION_MASK + 1)
7575
: 0) |
76-
(MANTISSA_MASK & bits);
76+
(FRACTION_MASK & bits);
7777
}
7878

7979
LIBC_INLINE constexpr void set_sign(bool signVal) {
@@ -92,10 +92,10 @@ template <typename T> struct FPBits : private FloatProperties<T> {
9292
static constexpr int MAX_EXPONENT = (1 << EXPONENT_WIDTH) - 1;
9393

9494
static constexpr UIntType MIN_SUBNORMAL = UIntType(1);
95-
static constexpr UIntType MAX_SUBNORMAL = (UIntType(1) << MANTISSA_WIDTH) - 1;
96-
static constexpr UIntType MIN_NORMAL = (UIntType(1) << MANTISSA_WIDTH);
95+
static constexpr UIntType MAX_SUBNORMAL = FRACTION_MASK;
96+
static constexpr UIntType MIN_NORMAL = (UIntType(1) << FRACTION_BITS);
9797
static constexpr UIntType MAX_NORMAL =
98-
((UIntType(MAX_EXPONENT) - 1) << MANTISSA_WIDTH) | MAX_SUBNORMAL;
98+
((UIntType(MAX_EXPONENT) - 1) << FRACTION_BITS) | MAX_SUBNORMAL;
9999

100100
// We don't want accidental type promotions/conversions, so we require exact
101101
// type match.

libc/src/__support/FPUtil/FloatProperties.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,16 @@ struct FPProperties : public internal::FPBaseProperties<fp_type> {
152152
? bit_at(SIG_BITS - 1) | bit_at(SIG_BITS - 3) // 0b1010...
153153
: bit_at(SIG_BITS - 2); // 0b0100...
154154

155-
// The number of bits after the decimal dot when the number if in normal form.
155+
public:
156+
LIBC_INLINE_VAR static constexpr uint32_t BIT_WIDTH = TOTAL_BITS;
157+
// The number of bits after the decimal dot when the number is in normal form.
156158
LIBC_INLINE_VAR static constexpr int FRACTION_BITS =
157159
UP::ENCODING == internal::FPEncoding::X86_ExtendedPrecision ? SIG_BITS - 1
158160
: SIG_BITS;
159-
160-
public:
161-
LIBC_INLINE_VAR static constexpr uint32_t BIT_WIDTH = TOTAL_BITS;
162-
LIBC_INLINE_VAR static constexpr uint32_t MANTISSA_WIDTH = FRACTION_BITS;
163161
LIBC_INLINE_VAR static constexpr uint32_t MANTISSA_PRECISION =
164-
MANTISSA_WIDTH + 1;
165-
LIBC_INLINE_VAR static constexpr UIntType MANTISSA_MASK =
166-
mask_trailing_ones<UIntType, MANTISSA_WIDTH>();
162+
FRACTION_BITS + 1;
163+
LIBC_INLINE_VAR static constexpr UIntType FRACTION_MASK =
164+
mask_trailing_ones<UIntType, FRACTION_BITS>();
167165
LIBC_INLINE_VAR static constexpr uint32_t EXPONENT_WIDTH = EXP_BITS;
168166
LIBC_INLINE_VAR static constexpr int32_t EXPONENT_BIAS = EXP_BIAS;
169167
LIBC_INLINE_VAR static constexpr UIntType EXPONENT_MASK = EXP_MASK;

libc/src/__support/FPUtil/Hypot.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ LIBC_INLINE T hypot(T x, T y) {
124124
uint16_t y_exp = y_bits.get_biased_exponent();
125125
uint16_t exp_diff = (x_exp > y_exp) ? (x_exp - y_exp) : (y_exp - x_exp);
126126

127-
if ((exp_diff >= FPBits_t::MANTISSA_WIDTH + 2) || (x == 0) || (y == 0)) {
127+
if ((exp_diff >= FPBits_t::FRACTION_BITS + 2) || (x == 0) || (y == 0)) {
128128
return abs(x) + abs(y);
129129
}
130130

@@ -148,7 +148,7 @@ LIBC_INLINE T hypot(T x, T y) {
148148
out_exp = a_exp;
149149

150150
// Add an extra bit to simplify the final rounding bit computation.
151-
constexpr UIntType ONE = UIntType(1) << (FPBits_t::MANTISSA_WIDTH + 1);
151+
constexpr UIntType ONE = UIntType(1) << (FPBits_t::FRACTION_BITS + 1);
152152

153153
a_mant <<= 1;
154154
b_mant <<= 1;
@@ -158,7 +158,7 @@ LIBC_INLINE T hypot(T x, T y) {
158158
if (a_exp != 0) {
159159
leading_one = ONE;
160160
a_mant |= ONE;
161-
y_mant_width = FPBits_t::MANTISSA_WIDTH + 1;
161+
y_mant_width = FPBits_t::FRACTION_BITS + 1;
162162
} else {
163163
leading_one = internal::find_leading_one(a_mant, y_mant_width);
164164
a_exp = 1;
@@ -258,7 +258,7 @@ LIBC_INLINE T hypot(T x, T y) {
258258
}
259259
}
260260

261-
y_new |= static_cast<UIntType>(out_exp) << FPBits_t::MANTISSA_WIDTH;
261+
y_new |= static_cast<UIntType>(out_exp) << FPBits_t::FRACTION_BITS;
262262
return cpp::bit_cast<T>(y_new);
263263
}
264264

libc/src/__support/FPUtil/ManipulationFunctions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ LIBC_INLINE T ldexp(T x, int exp) {
130130
// early. Because the result of the ldexp operation can be a subnormal number,
131131
// we need to accommodate the (mantissaWidht + 1) worth of shift in
132132
// calculating the limit.
133-
int exp_limit = FPBits<T>::MAX_EXPONENT + FPBits<T>::MANTISSA_WIDTH + 1;
133+
int exp_limit = FPBits<T>::MAX_EXPONENT + FPBits<T>::FRACTION_BITS + 1;
134134
if (exp > exp_limit)
135135
return bits.get_sign() ? T(FPBits<T>::neg_inf()) : T(FPBits<T>::inf());
136136

libc/src/__support/FPUtil/NearestIntegerOperations.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ LIBC_INLINE T trunc(T x) {
3636

3737
// If the exponent is greater than the most negative mantissa
3838
// exponent, then x is already an integer.
39-
if (exponent >= static_cast<int>(FPBits<T>::MANTISSA_WIDTH))
39+
if (exponent >= static_cast<int>(FPBits<T>::FRACTION_BITS))
4040
return x;
4141

4242
// If the exponent is such that abs(x) is less than 1, then return 0.
@@ -47,7 +47,7 @@ LIBC_INLINE T trunc(T x) {
4747
return T(0.0);
4848
}
4949

50-
int trim_size = FPBits<T>::MANTISSA_WIDTH - exponent;
50+
int trim_size = FPBits<T>::FRACTION_BITS - exponent;
5151
bits.set_mantissa((bits.get_mantissa() >> trim_size) << trim_size);
5252
return T(bits);
5353
}
@@ -65,7 +65,7 @@ LIBC_INLINE T ceil(T x) {
6565

6666
// If the exponent is greater than the most negative mantissa
6767
// exponent, then x is already an integer.
68-
if (exponent >= static_cast<int>(FPBits<T>::MANTISSA_WIDTH))
68+
if (exponent >= static_cast<int>(FPBits<T>::FRACTION_BITS))
6969
return x;
7070

7171
if (exponent <= -1) {
@@ -75,7 +75,7 @@ LIBC_INLINE T ceil(T x) {
7575
return T(1.0);
7676
}
7777

78-
uint32_t trim_size = FPBits<T>::MANTISSA_WIDTH - exponent;
78+
uint32_t trim_size = FPBits<T>::FRACTION_BITS - exponent;
7979
bits.set_mantissa((bits.get_mantissa() >> trim_size) << trim_size);
8080
T trunc_value = T(bits);
8181

@@ -114,7 +114,7 @@ LIBC_INLINE T round(T x) {
114114

115115
// If the exponent is greater than the most negative mantissa
116116
// exponent, then x is already an integer.
117-
if (exponent >= static_cast<int>(FPBits<T>::MANTISSA_WIDTH))
117+
if (exponent >= static_cast<int>(FPBits<T>::FRACTION_BITS))
118118
return x;
119119

120120
if (exponent == -1) {
@@ -133,7 +133,7 @@ LIBC_INLINE T round(T x) {
133133
return T(0.0);
134134
}
135135

136-
uint32_t trim_size = FPBits<T>::MANTISSA_WIDTH - exponent;
136+
uint32_t trim_size = FPBits<T>::FRACTION_BITS - exponent;
137137
bool half_bit_set =
138138
bool(bits.get_mantissa() & (UIntType(1) << (trim_size - 1)));
139139
bits.set_mantissa((bits.get_mantissa() >> trim_size) << trim_size);
@@ -167,7 +167,7 @@ LIBC_INLINE T round_using_current_rounding_mode(T x) {
167167

168168
// If the exponent is greater than the most negative mantissa
169169
// exponent, then x is already an integer.
170-
if (exponent >= static_cast<int>(FPBits<T>::MANTISSA_WIDTH))
170+
if (exponent >= static_cast<int>(FPBits<T>::FRACTION_BITS))
171171
return x;
172172

173173
if (exponent <= -1) {
@@ -188,7 +188,7 @@ LIBC_INLINE T round_using_current_rounding_mode(T x) {
188188
}
189189
}
190190

191-
uint32_t trim_size = FPBits<T>::MANTISSA_WIDTH - exponent;
191+
uint32_t trim_size = FPBits<T>::FRACTION_BITS - exponent;
192192
FPBits<T> new_bits = bits;
193193
new_bits.set_mantissa((bits.get_mantissa() >> trim_size) << trim_size);
194194
T trunc_value = T(new_bits);

libc/src/__support/FPUtil/NormalFloat.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ template <typename T> struct NormalFloat {
3232
"NormalFloat template parameter has to be a floating point type.");
3333

3434
using UIntType = typename FPBits<T>::UIntType;
35-
static constexpr UIntType ONE = (UIntType(1) << FPBits<T>::MANTISSA_WIDTH);
35+
static constexpr UIntType ONE = (UIntType(1) << FPBits<T>::FRACTION_BITS);
3636

3737
// Unbiased exponent value.
3838
int32_t exponent;
3939

4040
UIntType mantissa;
4141
// We want |UIntType| to have atleast one bit more than the actual mantissa
4242
// bit width to accommodate the implicit 1 value.
43-
static_assert(sizeof(UIntType) * 8 >= FPBits<T>::MANTISSA_WIDTH + 1,
43+
static_assert(sizeof(UIntType) * 8 >= FPBits<T>::FRACTION_BITS + 1,
4444
"Bad type for mantissa in NormalFloat.");
4545

4646
bool sign;
@@ -105,7 +105,7 @@ template <typename T> struct NormalFloat {
105105
unsigned shift = SUBNORMAL_EXPONENT - exponent;
106106
// Since exponent > subnormalExponent, shift is strictly greater than
107107
// zero.
108-
if (shift <= FPBits<T>::MANTISSA_WIDTH + 1) {
108+
if (shift <= FPBits<T>::FRACTION_BITS + 1) {
109109
// Generate a subnormal number. Might lead to loss of precision.
110110
// We round to nearest and round halfway cases to even.
111111
const UIntType shift_out_mask = (UIntType(1) << shift) - 1;
@@ -163,7 +163,7 @@ template <typename T> struct NormalFloat {
163163

164164
LIBC_INLINE unsigned evaluate_normalization_shift(UIntType m) {
165165
unsigned shift = 0;
166-
for (; (ONE & m) == 0 && (shift < FPBits<T>::MANTISSA_WIDTH);
166+
for (; (ONE & m) == 0 && (shift < FPBits<T>::FRACTION_BITS);
167167
m <<= 1, ++shift)
168168
;
169169
return shift;
@@ -222,7 +222,7 @@ template <> LIBC_INLINE NormalFloat<long double>::operator long double() const {
222222
constexpr int SUBNORMAL_EXPONENT = -LDBits::EXPONENT_BIAS + 1;
223223
if (exponent < SUBNORMAL_EXPONENT) {
224224
unsigned shift = SUBNORMAL_EXPONENT - exponent;
225-
if (shift <= LDBits::MANTISSA_WIDTH + 1) {
225+
if (shift <= LDBits::FRACTION_BITS + 1) {
226226
// Generate a subnormal number. Might lead to loss of precision.
227227
// We round to nearest and round halfway cases to even.
228228
const UIntType shift_out_mask = (UIntType(1) << shift) - 1;

libc/src/__support/FPUtil/dyadic_float.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ template <size_t Bits> struct DyadicFloat {
4242

4343
template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
4444
DyadicFloat(T x) {
45-
static_assert(FloatProperties<T>::MANTISSA_WIDTH < Bits);
45+
static_assert(FloatProperties<T>::FRACTION_BITS < Bits);
4646
FPBits<T> x_bits(x);
4747
sign = x_bits.get_sign();
48-
exponent = x_bits.get_exponent() - FloatProperties<T>::MANTISSA_WIDTH;
48+
exponent = x_bits.get_exponent() - FloatProperties<T>::FRACTION_BITS;
4949
mantissa = MantissaType(x_bits.get_explicit_mantissa());
5050
normalize();
5151
}
@@ -86,7 +86,7 @@ template <size_t Bits> struct DyadicFloat {
8686
// TODO(lntue): Test or add specialization for x86 long double.
8787
template <typename T, typename = cpp::enable_if_t<
8888
cpp::is_floating_point_v<T> &&
89-
(FloatProperties<T>::MANTISSA_WIDTH < Bits),
89+
(FloatProperties<T>::FRACTION_BITS < Bits),
9090
void>>
9191
explicit operator T() const {
9292
// TODO(lntue): Do we need to treat signed zeros properly?
@@ -116,7 +116,7 @@ template <size_t Bits> struct DyadicFloat {
116116

117117
T d_hi = FPBits<T>::create_value(sign, exp_hi,
118118
static_cast<output_bits_t>(m_hi) &
119-
FloatProperties<T>::MANTISSA_MASK)
119+
FloatProperties<T>::FRACTION_MASK)
120120
.get_val();
121121

122122
const MantissaType round_mask = MantissaType(1) << (shift - 1);
@@ -157,7 +157,7 @@ template <size_t Bits> struct DyadicFloat {
157157
if (LIBC_UNLIKELY(denorm)) {
158158
// Output is denormal, simply clear the exponent field.
159159
output_bits_t clear_exp = output_bits_t(exp_hi)
160-
<< FloatProperties<T>::MANTISSA_WIDTH;
160+
<< FloatProperties<T>::FRACTION_BITS;
161161
output_bits_t r_bits = FPBits<T>(r).uintval() - clear_exp;
162162
return FPBits<T>(r_bits).get_val();
163163
}

libc/src/__support/FPUtil/fpbits_str.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ template <typename T> LIBC_INLINE cpp::string str(fputil::FPBits<T> x) {
5656
const details::ZeroPaddedHexFmt<uint16_t> exponent(x.get_biased_exponent());
5757
s += exponent.view();
5858

59-
if constexpr (cpp::is_same_v<T, long double> &&
60-
fputil::FloatProperties<long double>::MANTISSA_WIDTH == 63) {
59+
if constexpr (fputil::get_fp_type<T>() == fputil::FPType::X86_Binary80) {
6160
s += ", I: ";
6261
s += sign_char(x.get_implicit_bit());
6362
}

libc/src/__support/FPUtil/generic/FMA.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ template <> LIBC_INLINE double fma<double>(double x, double y, double z) {
159159

160160
UInt128 prod_mant = x_mant * y_mant << 10;
161161
int prod_lsb_exp =
162-
x_exp + y_exp - (FPBits::EXPONENT_BIAS + 2 * FPBits::MANTISSA_WIDTH + 10);
162+
x_exp + y_exp - (FPBits::EXPONENT_BIAS + 2 * FPBits::FRACTION_BITS + 10);
163163

164164
z_mant <<= 64;
165-
int z_lsb_exp = z_exp - (FPBits::MANTISSA_WIDTH + 64);
165+
int z_lsb_exp = z_exp - (FPBits::FRACTION_BITS + 64);
166166
bool round_bit = false;
167167
bool sticky_bits = false;
168168
bool z_shifted = false;
@@ -268,8 +268,8 @@ template <> LIBC_INLINE double fma<double>(double x, double y, double z) {
268268
}
269269

270270
// Remove hidden bit and append the exponent field and sign bit.
271-
result = (result & FloatProp::MANTISSA_MASK) |
272-
(static_cast<uint64_t>(r_exp) << FloatProp::MANTISSA_WIDTH);
271+
result = (result & FloatProp::FRACTION_MASK) |
272+
(static_cast<uint64_t>(r_exp) << FloatProp::FRACTION_BITS);
273273
if (prod_sign) {
274274
result |= FloatProp::SIGN_MASK;
275275
}

libc/src/__support/FPUtil/generic/FMod.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ class FMod {
236236
int e_y = sy.get_biased_exponent();
237237

238238
// Most common case where |y| is "very normal" and |x/y| < 2^EXPONENT_WIDTH
239-
if (LIBC_LIKELY(e_y > int(FPB::MANTISSA_WIDTH) &&
239+
if (LIBC_LIKELY(e_y > int(FPB::FRACTION_BITS) &&
240240
e_x - e_y <= int(FPB::EXPONENT_WIDTH))) {
241241
UIntType m_x = sx.get_explicit_mantissa();
242242
UIntType m_y = sy.get_explicit_mantissa();

libc/src/__support/FPUtil/generic/sqrt.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ template <typename T>
3737
LIBC_INLINE void normalize(int &exponent,
3838
typename FPBits<T>::UIntType &mantissa) {
3939
const int shift = cpp::countl_zero(mantissa) -
40-
(8 * sizeof(mantissa) - 1 - FPBits<T>::MANTISSA_WIDTH);
40+
(8 * sizeof(mantissa) - 1 - FPBits<T>::FRACTION_BITS);
4141
exponent -= shift;
4242
mantissa <<= shift;
4343
}
@@ -72,7 +72,7 @@ LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, T> sqrt(T x) {
7272
} else {
7373
// IEEE floating points formats.
7474
using UIntType = typename FPBits<T>::UIntType;
75-
constexpr UIntType ONE = UIntType(1) << FPBits<T>::MANTISSA_WIDTH;
75+
constexpr UIntType ONE = UIntType(1) << FPBits<T>::FRACTION_BITS;
7676

7777
FPBits<T> bits(x);
7878

@@ -148,7 +148,7 @@ LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, T> sqrt(T x) {
148148
x_exp = ((x_exp >> 1) + FPBits<T>::EXPONENT_BIAS);
149149

150150
y = (y - ONE) |
151-
(static_cast<UIntType>(x_exp) << FPBits<T>::MANTISSA_WIDTH);
151+
(static_cast<UIntType>(x_exp) << FPBits<T>::FRACTION_BITS);
152152

153153
switch (quick_get_round()) {
154154
case FE_TONEAREST:

libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace x86 {
2323
LIBC_INLINE void normalize(int &exponent, UInt128 &mantissa) {
2424
const unsigned int shift = static_cast<unsigned int>(
2525
cpp::countl_zero(static_cast<uint64_t>(mantissa)) -
26-
(8 * sizeof(uint64_t) - 1 - FPBits<long double>::MANTISSA_WIDTH));
26+
(8 * sizeof(uint64_t) - 1 - FPBits<long double>::FRACTION_BITS));
2727
exponent -= shift;
2828
mantissa <<= shift;
2929
}
@@ -38,7 +38,7 @@ LIBC_INLINE long double sqrt(long double x);
3838
LIBC_INLINE long double sqrt(long double x) {
3939
using LDBits = FPBits<long double>;
4040
using UIntType = typename LDBits::UIntType;
41-
constexpr UIntType ONE = UIntType(1) << int(LDBits::MANTISSA_WIDTH);
41+
constexpr UIntType ONE = UIntType(1) << int(LDBits::FRACTION_BITS);
4242

4343
FPBits<long double> bits(x);
4444

@@ -111,7 +111,7 @@ LIBC_INLINE long double sqrt(long double x) {
111111

112112
// Append the exponent field.
113113
x_exp = ((x_exp >> 1) + LDBits::EXPONENT_BIAS);
114-
y |= (static_cast<UIntType>(x_exp) << (LDBits::MANTISSA_WIDTH + 1));
114+
y |= (static_cast<UIntType>(x_exp) << (LDBits::FRACTION_BITS + 1));
115115

116116
switch (quick_get_round()) {
117117
case FE_TONEAREST:

0 commit comments

Comments
 (0)