Documentation

Init.Data.Float32

structure Float32 :

Native floating point type, corresponding to the IEEE 754 binary32 format (float in C or f32 in Rust).

Instances For
    @[extern lean_float32_add]
    @[extern lean_float32_sub]
    @[extern lean_float32_mul]
    @[extern lean_float32_div]
    @[extern lean_float32_negate]
    Equations
    • a.lt b = match a, b with | { val := a }, { val := b } => float32Spec.lt a b
    Instances For
      Equations
      Instances For
        @[extern lean_float32_of_bits]

        Raw transmutation from UInt32.

        Float32s and UInts have the same endianness on all supported platforms. IEEE 754 very precisely specifies the bit layout of floats.

        @[extern lean_float32_to_bits]

        Raw transmutation to UInt32.

        Float32s and UInts have the same endianness on all supported platforms. IEEE 754 very precisely specifies the bit layout of floats.

        Note that this function is distinct from Float32.toUInt32, which attempts to preserve the numeric value, and not the bitwise value.

        @[extern lean_float32_beq]
        opaque Float32.beq (a b : Float32) :

        Note: this is not reflexive since NaN != NaN.

        @[extern lean_float32_decLt]
        opaque Float32.decLt (a b : Float32) :
        Decidable (a < b)
        @[extern lean_float32_decLe]
        opaque Float32.decLe (a b : Float32) :
        instance float32DecLt (a b : Float32) :
        Decidable (a < b)
        Equations
        instance float32DecLe (a b : Float32) :
        Equations
        @[extern lean_float32_to_string]
        @[extern lean_float32_to_uint8]

        If the given float is non-negative, truncates the value to the nearest non-negative integer. If negative or NaN, returns 0. If larger than the maximum value for UInt8 (including Inf), returns the maximum value of UInt8 (i.e. UInt8.size - 1).

        @[extern lean_float32_to_uint16]

        If the given float is non-negative, truncates the value to the nearest non-negative integer. If negative or NaN, returns 0. If larger than the maximum value for UInt16 (including Inf), returns the maximum value of UInt16 (i.e. UInt16.size - 1).

        @[extern lean_float32_to_uint32]

        If the given float is non-negative, truncates the value to the nearest non-negative integer. If negative or NaN, returns 0. If larger than the maximum value for UInt32 (including Inf), returns the maximum value of UInt32 (i.e. UInt32.size - 1).

        @[extern lean_float32_to_uint64]

        If the given float is non-negative, truncates the value to the nearest non-negative integer. If negative or NaN, returns 0. If larger than the maximum value for UInt64 (including Inf), returns the maximum value of UInt64 (i.e. UInt64.size - 1).

        @[extern lean_float32_to_usize]

        If the given float is non-negative, truncates the value to the nearest non-negative integer. If negative or NaN, returns 0. If larger than the maximum value for USize (including Inf), returns the maximum value of USize (i.e. USize.size - 1). This value is platform dependent).

        @[extern lean_float32_isnan]
        @[extern lean_float32_isfinite]
        @[extern lean_float32_isinf]
        @[extern lean_float32_frexp]

        Splits the given float x into a significand/exponent pair (s, i) such that x = s * 2^i where s ∈ (-1;-0.5] ∪ [0.5; 1). Returns an undefined value if x is not finite.

        @[extern lean_uint64_to_float32]
        Equations
        • One or more equations did not get rendered due to their size.
        @[extern sinf]
        @[extern cosf]
        @[extern tanf]
        @[extern asinf]
        @[extern acosf]
        @[extern atanf]
        @[extern atan2f]
        @[extern sinhf]
        @[extern coshf]
        @[extern tanhf]
        @[extern asinhf]
        @[extern acoshf]
        @[extern atanhf]
        @[extern expf]
        @[extern exp2f]
        @[extern logf]
        @[extern log2f]
        @[extern log10f]
        @[extern powf]
        @[extern sqrtf]
        @[extern cbrtf]
        @[extern ceilf]
        @[extern floorf]
        @[extern roundf]
        @[extern fabsf]
        @[extern lean_float32_scaleb]
        opaque Float32.scaleB (x : Float32) (i : Int) :

        Efficiently computes x * 2^i.

        @[extern lean_float32_to_float]
        @[extern lean_float_to_float32]