Skip to content
FutureBlitz

    Install

    Import std.math.numbers

    std.math.numbers

    What the built-in number types share, for std.math's generic Functions: Bounded, the types with a lowest and a highest value, which every number type is; Integer, the eight integer types; and FloatingPoint, Float32 and Float64, over C's libm. A Function that takes a T of one of them gets its type from its arguments, so Lerp(0, 10, t) works in t's type, and its literals follow. Their Static Methods are for generic code, through a type parameter, as in T.MinValue(); for the types themselves, std.math's Functions are the way, as MinValue<Int>() and Floor(x).

    std/math/numbers.fb

    Types

    Bounded interface

    Public Interface Bounded

    The types with a lowest and a highest value: every number type. A float's are its lowest and highest finite values, not the infinities. Each is a Double too, for math like a Mean.

    std/math/numbers.fb, line 70

    • Static Method MinValue(): Self static method #

      The type's lowest value: a float's lowest finite one.

    • Static Method MaxValue(): Self static method #

      The type's highest value: a float's highest finite one.

    • Static Method DoubleValue(value: Self): Float64 static method #

      The value as a Double, rounded to the nearest one where a Long's is too large to hold.

    Integer interface

    Public Interface Integer Extends Bounded

    The eight integer types, whose bits generic code works on through a UInt64.

    std/math/numbers.fb, line 80

    • Static Method BitWidth(): Int static method #

      How many bits the type has: 8, 16, 32, or 64.

    • Static Method LowBits(value: Self): UInt64 static method #

      The value's bits, BitWidth of them, in a UInt64's low bits, the rest 0.

    • Static Method FromLowBits(bits: UInt64): Self static method #

      The value whose bits are the low BitWidth of bits.

    FloatingPoint interface

    Public Interface FloatingPoint Extends Bounded

    Float32 and Float64, with what C's libm works out for each. Rounding is half away from 0, and Rem is C's fmod, which is exact.

    std/math/numbers.fb, line 91

    • Static Method Epsilon(): Self static method #

      The gap between 1 and the next value above it.

    • Static Method FromDouble(value: Float64): Self static method #

      The Double as this type, rounded to the nearest value it holds.

    • Static Method Floor(value: Self): Self static method #

      The largest whole number no larger than value.

    • Static Method Ceil(value: Self): Self static method #

      The smallest whole number no smaller than value.

    • Static Method Round(value: Self): Self static method #

      The whole number nearest value, a half away from 0.

    • Static Method Trunc(value: Self): Self static method #

      value without what's after its point: the whole number toward 0.

    • Static Method Sqrt(value: Self): Self static method #

      The square root of value, or NaN for a negative one.

    • Static Method Cbrt(value: Self): Self static method #

      The cube root of value.

    • Static Method Exp(value: Self): Self static method #

      e to the power of value.

    • Static Method Exp2(value: Self): Self static method #

      2 to the power of value.

    • Static Method Log(value: Self): Self static method #

      The natural logarithm of value.

    • Static Method Log2(value: Self): Self static method #

      The base 2 logarithm of value.

    • Static Method Log10(value: Self): Self static method #

      The base 10 logarithm of value.

    • Static Method Sin(value: Self): Self static method #

      The sine of value, in radians.

    • Static Method Cos(value: Self): Self static method #

      The cosine of value, in radians.

    • Static Method Tan(value: Self): Self static method #

      The tangent of value, in radians.

    • Static Method Asin(value: Self): Self static method #

      The angle, in radians, whose sine is value.

    • Static Method Acos(value: Self): Self static method #

      The angle, in radians, whose cosine is value.

    • Static Method Atan(value: Self): Self static method #

      The angle, in radians, whose tangent is value.

    • Static Method Atan2(y: Self, x: Self): Self static method #

      The angle, in radians, of the point (x, y) from the positive x axis, from -pi to pi.

    • Static Method Sinh(value: Self): Self static method #

      The hyperbolic sine of value.

    • Static Method Cosh(value: Self): Self static method #

      The hyperbolic cosine of value.

    • Static Method Tanh(value: Self): Self static method #

      The hyperbolic tangent of value.

    • Static Method Asinh(value: Self): Self static method #

      The inverse hyperbolic sine of value.

    • Static Method Acosh(value: Self): Self static method #

      The inverse hyperbolic cosine of value.

    • Static Method Atanh(value: Self): Self static method #

      The inverse hyperbolic tangent of value.

    • Static Method Rem(a: Self, b: Self): Self static method #

      What's left of a divided by b, with a's sign, as C's fmod gives it.

    • Static Method CopySign(magnitude: Self, sign: Self): Self static method #

      magnitude's size with sign's sign.

    • Static Method Fma(a: Self, b: Self, c: Self): Self static method #

      a times b, plus c, rounded once.

    Functions

    MinValue function

    Public Function MinValue<T: Bounded>(): T

    The lowest value a T holds: for a float, its lowest finite one.

    std/math/numbers.fb, line 331

    MaxValue function

    Public Function MaxValue<T: Bounded>(): T

    The highest value a T holds: for a float, its highest finite one.

    std/math/numbers.fb, line 334

    Extends

    Int8 extend

    Extend Int8 Implements Integer

    No doc comment.

    std/math/numbers.fb, line 152

    Int16 extend

    Extend Int16 Implements Integer

    No doc comment.

    std/math/numbers.fb, line 161

    Int32 extend

    Extend Int32 Implements Integer

    No doc comment.

    std/math/numbers.fb, line 170

    Int64 extend

    Extend Int64 Implements Integer

    No doc comment.

    std/math/numbers.fb, line 179

    UInt8 extend

    Extend UInt8 Implements Integer

    No doc comment.

    std/math/numbers.fb, line 188

    UInt16 extend

    Extend UInt16 Implements Integer

    No doc comment.

    std/math/numbers.fb, line 197

    UInt32 extend

    Extend UInt32 Implements Integer

    No doc comment.

    std/math/numbers.fb, line 206

    UInt64 extend

    Extend UInt64 Implements Integer

    No doc comment.

    std/math/numbers.fb, line 215

    Float32 extend

    Extend Float32 Implements FloatingPoint

    No doc comment.

    std/math/numbers.fb, line 224

    Float64 extend

    Extend Float64 Implements FloatingPoint

    No doc comment.

    std/math/numbers.fb, line 259

    Float32 extend

    Extend Float32

    No doc comment.

    std/math/numbers.fb, line 294

    • Public Method ToBits(): UInt32 method #

      The Float's bits, as IEEE 754 lays them out.

    • Public Static Method FromBits(bits: UInt32): Float32 static method #

      The Float whose IEEE 754 bits these are.

    Float64 extend

    Extend Float64

    No doc comment.

    std/math/numbers.fb, line 312

    • Public Method ToBits(): UInt64 method #

      The Double's bits, as IEEE 754 lays them out.

    • Public Static Method FromBits(bits: UInt64): Float64 static method #

      The Double whose IEEE 754 bits these are.

    Report an issue with this page or with FutureBlitz on GitHub.