3 changes: 1 addition & 2 deletions libc/test/src/math/LdExpTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ class LdExpTestTemplate : public LIBC_NAMESPACE::testing::Test {
using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using NormalFloat = LIBC_NAMESPACE::fputil::NormalFloat<T>;
using UIntType = typename FPBits::UIntType;
static constexpr UIntType MANTISSA_WIDTH =
LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE;
static constexpr UIntType MANTISSA_WIDTH = FPBits::MANTISSA_WIDTH;
// A normalized mantissa to be used with tests.
static constexpr UIntType MANTISSA = NormalFloat::ONE + 0x1234;

Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/LogbTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ template <typename T> class LogbTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)

static constexpr UIntType HIDDEN_BIT =
UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE;
UIntType(1) << LIBC_NAMESPACE::fputil::FloatProperties<T>::MANTISSA_WIDTH;

public:
typedef T (*LogbFunc)(T);
Expand Down
5 changes: 2 additions & 3 deletions libc/test/src/math/NextAfterTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
template <typename T>
class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::Test {
using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using MantissaWidth = LIBC_NAMESPACE::fputil::MantissaWidth<T>;
using UIntType = typename FPBits::UIntType;

static constexpr int BIT_WIDTH_OF_TYPE =
Expand Down Expand Up @@ -165,7 +164,7 @@ class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::Test {
ASSERT_EQ(result_bits.get_biased_exponent(),
uint16_t(x_bits.get_biased_exponent() - 1));
ASSERT_EQ(result_bits.get_mantissa(),
(UIntType(1) << MantissaWidth::VALUE) - 1);
(UIntType(1) << FPBits::MANTISSA_WIDTH) - 1);

result = func(x, T(33.0));
result_bits = FPBits(result);
Expand All @@ -179,7 +178,7 @@ class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::Test {
ASSERT_EQ(result_bits.get_biased_exponent(),
uint16_t(x_bits.get_biased_exponent() - 1));
ASSERT_EQ(result_bits.get_mantissa(),
(UIntType(1) << MantissaWidth::VALUE) - 1);
(UIntType(1) << FPBits::MANTISSA_WIDTH) - 1);

result = func(x, T(-33.0));
result_bits = FPBits(result);
Expand Down
13 changes: 6 additions & 7 deletions libc/test/src/math/RoundToIntegerTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ class RoundToIntegerTestTemplate : public LIBC_NAMESPACE::testing::Test {
using FPBits = LIBC_NAMESPACE::fputil::FPBits<F>;
using UIntType = typename FPBits::UIntType;

const F zero = F(LIBC_NAMESPACE::fputil::FPBits<F>::zero());
const F neg_zero = F(LIBC_NAMESPACE::fputil::FPBits<F>::neg_zero());
const F inf = F(LIBC_NAMESPACE::fputil::FPBits<F>::inf());
const F neg_inf = F(LIBC_NAMESPACE::fputil::FPBits<F>::neg_inf());
const F nan = F(LIBC_NAMESPACE::fputil::FPBits<F>::build_quiet_nan(1));
const F zero = F(FPBits::zero());
const F neg_zero = F(FPBits::neg_zero());
const F inf = F(FPBits::inf());
const F neg_inf = F(FPBits::neg_inf());
const F nan = F(FPBits::build_quiet_nan(1));
static constexpr I INTEGER_MIN = I(1) << (sizeof(I) * 8 - 1);
static constexpr I INTEGER_MAX = -(INTEGER_MIN + 1);

Expand Down Expand Up @@ -192,8 +192,7 @@ class RoundToIntegerTestTemplate : public LIBC_NAMESPACE::testing::Test {
FPBits bits(F(1.0));
bits.set_biased_exponent(EXPONENT_LIMIT + FPBits::EXPONENT_BIAS);
bits.set_sign(1);
bits.set_mantissa(UIntType(0x1)
<< (LIBC_NAMESPACE::fputil::MantissaWidth<F>::VALUE - 1));
bits.set_mantissa(UIntType(0x1) << (FPBits::MANTISSA_WIDTH - 1));

F x = F(bits);
if (TestModes) {
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/SqrtTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ template <typename T> class SqrtTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)

static constexpr UIntType HIDDEN_BIT =
UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE;
UIntType(1) << LIBC_NAMESPACE::fputil::FloatProperties<T>::MANTISSA_WIDTH;

public:
typedef T (*SqrtFunc)(T);
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/smoke/FrexpTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ template <typename T> class FrexpTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)

static constexpr UIntType HIDDEN_BIT =
UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE;
UIntType(1) << LIBC_NAMESPACE::fputil::FloatProperties<T>::MANTISSA_WIDTH;

public:
typedef T (*FrexpFunc)(T, int *);
Expand Down
3 changes: 1 addition & 2 deletions libc/test/src/math/smoke/LdExpTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ class LdExpTestTemplate : public LIBC_NAMESPACE::testing::Test {
using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using NormalFloat = LIBC_NAMESPACE::fputil::NormalFloat<T>;
using UIntType = typename FPBits::UIntType;
static constexpr UIntType MANTISSA_WIDTH =
LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE;
static constexpr UIntType MANTISSA_WIDTH = FPBits::MANTISSA_WIDTH;
// A normalized mantissa to be used with tests.
static constexpr UIntType MANTISSA = NormalFloat::ONE + 0x1234;

Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/smoke/LogbTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ template <typename T> class LogbTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)

static constexpr UIntType HIDDEN_BIT =
UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE;
UIntType(1) << LIBC_NAMESPACE::fputil::FloatProperties<T>::MANTISSA_WIDTH;

public:
typedef T (*LogbFunc)(T);
Expand Down
5 changes: 2 additions & 3 deletions libc/test/src/math/smoke/NextAfterTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
template <typename T>
class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::Test {
using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using MantissaWidth = LIBC_NAMESPACE::fputil::MantissaWidth<T>;
using UIntType = typename FPBits::UIntType;

static constexpr int BIT_WIDTH_OF_TYPE =
Expand Down Expand Up @@ -176,7 +175,7 @@ class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::Test {
ASSERT_EQ(result_bits.get_biased_exponent(),
uint16_t(x_bits.get_biased_exponent() - 1));
ASSERT_EQ(result_bits.get_mantissa(),
(UIntType(1) << MantissaWidth::VALUE) - 1);
(UIntType(1) << FPBits::MANTISSA_WIDTH) - 1);

result = func(x, T(33.0));
result_bits = FPBits(result);
Expand All @@ -190,7 +189,7 @@ class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::Test {
ASSERT_EQ(result_bits.get_biased_exponent(),
uint16_t(x_bits.get_biased_exponent() - 1));
ASSERT_EQ(result_bits.get_mantissa(),
(UIntType(1) << MantissaWidth::VALUE) - 1);
(UIntType(1) << FPBits::MANTISSA_WIDTH) - 1);

result = func(x, T(-33.0));
result_bits = FPBits(result);
Expand Down
5 changes: 2 additions & 3 deletions libc/test/src/math/smoke/NextTowardTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ template <typename T>
class NextTowardTestTemplate : public LIBC_NAMESPACE::testing::Test {
using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using ToFPBits = LIBC_NAMESPACE::fputil::FPBits<long double>;
using MantissaWidth = LIBC_NAMESPACE::fputil::MantissaWidth<T>;
using UIntType = typename FPBits::UIntType;

static constexpr int BIT_WIDTH_OF_TYPE =
Expand Down Expand Up @@ -190,7 +189,7 @@ class NextTowardTestTemplate : public LIBC_NAMESPACE::testing::Test {
ASSERT_EQ(result_bits.get_biased_exponent(),
uint16_t(x_bits.get_biased_exponent() - 1));
ASSERT_EQ(result_bits.get_mantissa(),
(UIntType(1) << MantissaWidth::VALUE) - 1);
(UIntType(1) << FPBits::MANTISSA_WIDTH) - 1);

result = func(x, 33.0);
result_bits = FPBits(result);
Expand All @@ -204,7 +203,7 @@ class NextTowardTestTemplate : public LIBC_NAMESPACE::testing::Test {
ASSERT_EQ(result_bits.get_biased_exponent(),
uint16_t(x_bits.get_biased_exponent() - 1));
ASSERT_EQ(result_bits.get_mantissa(),
(UIntType(1) << MantissaWidth::VALUE) - 1);
(UIntType(1) << FPBits::MANTISSA_WIDTH) - 1);

result = func(x, -33.0);
result_bits = FPBits(result);
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/smoke/SqrtTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ template <typename T> class SqrtTest : public LIBC_NAMESPACE::testing::Test {
DECLARE_SPECIAL_CONSTANTS(T)

static constexpr UIntType HIDDEN_BIT =
UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE;
UIntType(1) << LIBC_NAMESPACE::fputil::FloatProperties<T>::MANTISSA_WIDTH;

public:
typedef T (*SqrtFunc)(T);
Expand Down
6 changes: 3 additions & 3 deletions libc/utils/MPFRWrapper/MPFRUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ class MPFRNumber {
mpfr_sub(inputMPFR.value, value, inputMPFR.value, MPFR_RNDN);
mpfr_abs(inputMPFR.value, inputMPFR.value, MPFR_RNDN);
mpfr_mul_2si(inputMPFR.value, inputMPFR.value,
-thisExponent + int(fputil::MantissaWidth<T>::VALUE),
-thisExponent + int(fputil::FPBits<T>::MANTISSA_WIDTH),
MPFR_RNDN);
return inputMPFR;
}
Expand Down Expand Up @@ -496,12 +496,12 @@ class MPFRNumber {

mpfr_sub(minMPFR.value, pivot.value, minMPFR.value, MPFR_RNDN);
mpfr_mul_2si(minMPFR.value, minMPFR.value,
-minExponent + int(fputil::MantissaWidth<T>::VALUE),
-minExponent + int(fputil::FPBits<T>::MANTISSA_WIDTH),
MPFR_RNDN);

mpfr_sub(maxMPFR.value, maxMPFR.value, pivot.value, MPFR_RNDN);
mpfr_mul_2si(maxMPFR.value, maxMPFR.value,
-maxExponent + int(fputil::MantissaWidth<T>::VALUE),
-maxExponent + int(fputil::FPBits<T>::MANTISSA_WIDTH),
MPFR_RNDN);

mpfr_add(minMPFR.value, minMPFR.value, maxMPFR.value, MPFR_RNDN);
Expand Down