[libc][NFC] Rename MANTISSA_WIDTH in FRACTION_LEN (#75489)

This one might be a bit controversial since the terminology has been
introduced from the start but I think `FRACTION_LEN` 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 the
leading bit into account.
This patch also renames most of the properties to use the `_LEN` suffix
and fixes useless casts or variables.
This commit is contained in:
Guillaume Chatelet
2023-12-15 13:57:35 +01:00
committed by GitHub
parent 3a31cf8853
commit 3546f4da19
97 changed files with 875 additions and 886 deletions

View File

@@ -90,7 +90,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
int prec = 0;
int width = 0;
LIBC_NAMESPACE::fputil::FPBits<double>::UIntType raw_num = 0;
LIBC_NAMESPACE::fputil::FPBits<double>::StorageType raw_num = 0;
// Copy as many bytes of data as will fit into num, prec, and with. Any extras
// are ignored.

View File

@@ -33,7 +33,7 @@ template <typename F> inline constexpr int effective_precision(int exponent) {
// This is intended to be 0 when the exponent is the lowest normal and
// increase as the exponent's magnitude increases.
const int bits_below_normal =
(-exponent) - (FloatProperties<F>::EXPONENT_BIAS - 1);
(-exponent) - (FloatProperties<F>::EXP_BIAS - 1);
// The precision should be the normal, full precision, minus the bits lost
// by this being a subnormal, minus one for the implicit leading one.