template <size_t Bits>
struct DyadicFloat
Defined at line 105 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h
A generic class to perform computations of high precision floating points.
We store the value in dyadic format, including 3 fields:
sign : boolean value - false means positive, true means negative
exponent: the exponent value of the least significant bit of the mantissa.
mantissa: unsigned integer of length `Bits`.
So the real value that is stored is:
real value = (-1)^sign * 2^exponent * (mantissa as unsigned integer)
The stored data is normal if for non-zero mantissa, the leading bit is 1.
The outputs of the constructors and most functions will be normalized.
To simplify and improve the efficiency, many functions will assume that the
inputs are normal.
Public Members
Sign sign
int exponent
MantissaType mantissa
Public Methods
void DyadicFloat<Bits> ()
Defined at line 112 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h
template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
void DyadicFloat<Bits> (T x)
Defined at line 115 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h
void DyadicFloat<Bits> (Signs,inte,const MantissaType &m)
Defined at line 124 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h
DyadicFloat<Bits> & normalize ()
Normalizing the mantissa, bringing the leading 1 bit to the most
significant bit.
Defined at line 131 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h
DyadicFloat<Bits> & shift_left (unsigned int shift_length)
Used for aligning exponents. Output might not be normalized.
Defined at line 141 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h
DyadicFloat<Bits> & shift_right (unsigned int shift_length)
Used for aligning exponents. Output might not be normalized.
Defined at line 153 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h
int get_unbiased_exponent ()
Assume that it is already normalized. Output the unbiased exponent.
Defined at line 165 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h
template <size_t MantissaBits>
DyadicFloat<Bits> round (Signresult_sign,intresult_exponent,const __fuchsia_libc::UInt<MantissaBits> &input_mantissa,size_trshift)
Produce a correctly rounded DyadicFloat from a too-large mantissa,
by shifting it down and rounding if necessary.
Defined at line 172 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h
template <typename T, bool ShouldSignalExceptions>
cpp::enable_if_t<cpp::is_floating_point_v<T> && (FPBits<T>::FRACTION_LEN < Bits), T> generic_as ()
Defined at line 191 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h
template <typename T,bool ShouldSignalExceptions,typename = cpp::enable_if_t<cpp::is_floating_point_v<T> && (FPBits<T>::FRACTION_LEN < Bits), void>>
T fast_as ()
Defined at line 313 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h
template <typename T,bool ShouldSignalExceptions,typename = cpp::enable_if_t<cpp::is_floating_point_v<T> && (FPBits<T>::FRACTION_LEN < Bits), void>>
T as ()
Assume that it is already normalized.
Output is rounded correctly with respect to the current rounding mode.
Defined at line 440 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h
template <typename T, typename = cpp::enable_if_t<cpp::is_floating_point_v<T> && (FPBits<T>::FRACTION_LEN < Bits), void>>
T operator T ()
Defined at line 455 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h
MantissaType as_mantissa_type ()
Defined at line 459 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h
MantissaType as_mantissa_type_rounded (int * round_dir_out)
Defined at line 482 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h
DyadicFloat<Bits> operator- ()
Defined at line 518 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h