Namespaces

Enumerations

enum FPType
Name Value
IEEE754_Binary16 0
IEEE754_Binary32 1
IEEE754_Binary64 2
IEEE754_Binary128 3
X86_Binary80 4
BFloat16 5

The supported floating point types.

Defined at line 34 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/FPBits.h

Records

Functions

  • template <typename T>
    cpp::enable_if_t<(sizeof(T) > sizeof(void *)), T> multiply_add (const T & x, const T & y, const T & z)

    Implement a simple wrapper for multiply-add operation:

    multiply_add(x, y, z) = x*y + z

    which uses FMA instructions to speed up if available.

    Defined at line 26 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/multiply_add.h

  • template <size_t Bits>
    int rounding_direction (const __fuchsia_libc::UInt<Bits> & value, size_t rshift, Sign logical_sign)

    Decide whether to round a UInt up, down or not at all at a given bit

    position, based on the current rounding mode. The assumption is that the

    caller is going to make the integer `value >> rshift`, and then might need

    to round it up by 1 depending on the value of the bits shifted off the

    bottom.

    `logical_sign` causes the behavior of FE_DOWNWARD and FE_UPWARD to

    be reversed, which is what you'd want if this is the mantissa of a

    negative floating-point number.

    Return value is +1 if the value should be rounded up; -1 if it should be

    rounded down; 0 if it's exact and needs no rounding.

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

  • template <size_t Bits>
    int rounding_direction (const __fuchsia_libc::UInt<Bits> & value, size_t rshift, Sign logical_sign)

    Decide whether to round a UInt up, down or not at all at a given bit

    position, based on the current rounding mode. The assumption is that the

    caller is going to make the integer `value >> rshift`, and then might need

    to round it up by 1 depending on the value of the bits shifted off the

    bottom.

    `logical_sign` causes the behavior of FE_DOWNWARD and FE_UPWARD to

    be reversed, which is what you'd want if this is the mantissa of a

    negative floating-point number.

    Return value is +1 if the value should be rounded up; -1 if it should be

    rounded down; 0 if it's exact and needs no rounding.

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

  • int enable_except (int excepts)

    Enables exceptions in |excepts| and returns the previously set exceptions.

    Defined at line 87 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/arm/FEnvImpl.h

  • int disable_except (int excepts)

    Disables exceptions in |excepts| and returns the previously set exceptions.

    Defined at line 97 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/arm/FEnvImpl.h

  • int get_except ()

    Returns the currently enabled exceptions.

    Defined at line 107 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/arm/FEnvImpl.h

  • int clear_except (int excepts)

    Clears the exceptions in |excepts|.

    Defined at line 114 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/arm/FEnvImpl.h

  • int test_except (int excepts)

    Returns the set of exceptions which are from the input set |excepts|.

    Defined at line 123 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/arm/FEnvImpl.h

  • int set_except (int excepts)

    Set the exceptions in |excepts|.

    Defined at line 130 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/arm/FEnvImpl.h

  • int raise_except (int excepts)

    Defined at line 136 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/arm/FEnvImpl.h

  • int get_round ()

    Defined at line 190 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/arm/FEnvImpl.h

  • int set_round (int mode)

    Defined at line 207 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/arm/FEnvImpl.h

  • int get_env (fenv_t * envp)

    Defined at line 234 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/arm/FEnvImpl.h

  • int set_env (const fenv_t * envp)

    Defined at line 240 of file ../../third_party/llvm-libc/src/src/__support/FPUtil/arm/FEnvImpl.h

  • template <size_t Bits>
    DyadicFloat<Bits> quick_add (DyadicFloat<Bits> a, DyadicFloat<Bits> b)

    Quick add - Add 2 dyadic floats with rounding toward 0 and then normalize the

    output:

    - Align the exponents so that:

    new a.exponent = new b.exponent = max(a.exponent, b.exponent)

    - Add or subtract the mantissas depending on the signs.

    - Normalize the result.

    The absolute errors compared to the mathematical sum is bounded by:

    | quick_add(a, b) - (a + b) |

    <

    MSB(a + b) * 2^(-Bits + 2),

    i.e., errors are up to 2 ULPs.

    Assume inputs are normalized (by constructors or other functions) so that we

    don't need to normalize the inputs again in this function. If the inputs are

    not normalized, the results might lose precision significantly.

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

  • template <size_t Bits>
    DyadicFloat<Bits> quick_add (DyadicFloat<Bits> a, DyadicFloat<Bits> b)

    Quick add - Add 2 dyadic floats with rounding toward 0 and then normalize the

    output:

    - Align the exponents so that:

    new a.exponent = new b.exponent = max(a.exponent, b.exponent)

    - Add or subtract the mantissas depending on the signs.

    - Normalize the result.

    The absolute errors compared to the mathematical sum is bounded by:

    | quick_add(a, b) - (a + b) |

    <

    MSB(a + b) * 2^(-Bits + 2),

    i.e., errors are up to 2 ULPs.

    Assume inputs are normalized (by constructors or other functions) so that we

    don't need to normalize the inputs again in this function. If the inputs are

    not normalized, the results might lose precision significantly.

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

  • template <size_t Bits>
    DyadicFloat<Bits> quick_sub (DyadicFloat<Bits> a, DyadicFloat<Bits> b)

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

  • template <size_t Bits>
    DyadicFloat<Bits> quick_sub (DyadicFloat<Bits> a, DyadicFloat<Bits> b)

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

  • template <size_t Bits>
    DyadicFloat<Bits> quick_mul (const DyadicFloat<Bits> & a, const DyadicFloat<Bits> & b)

    Quick Mul - Slightly less accurate but efficient multiplication of 2 dyadic

    floats with rounding toward 0 and then normalize the output:

    result.exponent = a.exponent + b.exponent + Bits,

    result.mantissa = quick_mul_hi(a.mantissa + b.mantissa)

    ~ (full product a.mantissa * b.mantissa) >> Bits.

    The errors compared to the mathematical product is bounded by:

    2 * errors of quick_mul_hi = 2 * (UInt

    <Bits

    >::WORD_COUNT - 1) in ULPs.

    Assume inputs are normalized (by constructors or other functions) so that we

    don't need to normalize the inputs again in this function. If the inputs are

    not normalized, the results might lose precision significantly.

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

  • template <size_t Bits>
    DyadicFloat<Bits> quick_mul (const DyadicFloat<Bits> & a, const DyadicFloat<Bits> & b)

    Quick Mul - Slightly less accurate but efficient multiplication of 2 dyadic

    floats with rounding toward 0 and then normalize the output:

    result.exponent = a.exponent + b.exponent + Bits,

    result.mantissa = quick_mul_hi(a.mantissa + b.mantissa)

    ~ (full product a.mantissa * b.mantissa) >> Bits.

    The errors compared to the mathematical product is bounded by:

    2 * errors of quick_mul_hi = 2 * (UInt

    <Bits

    >::WORD_COUNT - 1) in ULPs.

    Assume inputs are normalized (by constructors or other functions) so that we

    don't need to normalize the inputs again in this function. If the inputs are

    not normalized, the results might lose precision significantly.

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

  • template <size_t Bits>
    DyadicFloat<Bits> rounded_mul (const DyadicFloat<Bits> & a, const DyadicFloat<Bits> & b)

    Correctly rounded multiplication of 2 dyadic floats, assuming the

    exponent remains within range.

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

  • template <size_t Bits>
    DyadicFloat<Bits> rounded_mul (const DyadicFloat<Bits> & a, const DyadicFloat<Bits> & b)

    Correctly rounded multiplication of 2 dyadic floats, assuming the

    exponent remains within range.

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

  • template <size_t Bits, typename = cpp::enable_if_t<(Bits >= 32)>>
    DyadicFloat<Bits> approx_reciprocal (const DyadicFloat<Bits> & a)

    Approximate reciprocal - given a nonzero a, make a good approximation to 1/a.

    The method is Newton-Raphson iteration, based on quick_mul.

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

  • template <size_t Bits, typename = cpp::enable_if_t<(Bits >= 32)>>
    DyadicFloat<Bits> approx_reciprocal (const DyadicFloat<Bits> & a)

    Approximate reciprocal - given a nonzero a, make a good approximation to 1/a.

    The method is Newton-Raphson iteration, based on quick_mul.

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

  • template <size_t Bits>
    DyadicFloat<Bits> rounded_div (const DyadicFloat<Bits> & af, const DyadicFloat<Bits> & bf)

    Correctly rounded division of 2 dyadic floats, assuming the

    exponent remains within range.

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

  • template <size_t Bits>
    DyadicFloat<Bits> rounded_div (const DyadicFloat<Bits> & af, const DyadicFloat<Bits> & bf)

    Correctly rounded division of 2 dyadic floats, assuming the

    exponent remains within range.

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

  • template <size_t Bits>
    DyadicFloat<Bits> multiply_add (const DyadicFloat<Bits> & a, const DyadicFloat<Bits> & b, const DyadicFloat<Bits> & c)

    Simple polynomial approximation.

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

  • template <size_t Bits>
    DyadicFloat<Bits> multiply_add (const DyadicFloat<Bits> & a, const DyadicFloat<Bits> & b, const DyadicFloat<Bits> & c)

    Simple polynomial approximation.

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

  • template <size_t Bits>
    DyadicFloat<Bits> pow_n (const DyadicFloat<Bits> & a, uint32_t power)

    Simple exponentiation implementation for printf. Only handles positive

    exponents, since division isn't implemented.

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

  • template <size_t Bits>
    DyadicFloat<Bits> pow_n (const DyadicFloat<Bits> & a, uint32_t power)

    Simple exponentiation implementation for printf. Only handles positive

    exponents, since division isn't implemented.

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

  • template <size_t Bits>
    DyadicFloat<Bits> mul_pow_2 (const DyadicFloat<Bits> & a, int32_t pow_2)

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

  • template <size_t Bits>
    DyadicFloat<Bits> mul_pow_2 (const DyadicFloat<Bits> & aint32_t pow_2)

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