template <size_t Bits>

struct DyadicFloat

Defined at line 88 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 95 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 98 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h

void DyadicFloat<Bits> (Sign s, int e, const MantissaType & m)

Defined at line 107 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 114 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 124 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 136 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 148 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h

template <size_t MantissaBits>
DyadicFloat<Bits> round (Sign result_sign, int result_exponent, const __fuchsia_libc::UInt<MantissaBits> & input_mantissa, size_t rshift)

Produce a correctly rounded DyadicFloat from a too-large mantissa,

by shifting it down and rounding if necessary.

Defined at line 155 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 174 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 284 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 411 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 426 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h

MantissaType as_mantissa_type ()

Defined at line 430 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 453 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h

DyadicFloat<Bits> operator- ()

Defined at line 489 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/dyadic_float.h