Skip to content
FutureBlitz

    Install

    Import std.math.constants

    std.math.constants

    Math's constants, like Pi and E, as Floats and as Doubles.

    The constants of math, as Floats, the type std.math works in, and as Doubles, named with 64: Pi64. Inf and NaN are a Float's, which a Double holds the same.

    std/math/constants.fb

    Constants and globals

    Pi const

    Public Const Pi: Float = 3.14159265358979323846

    Pi, half a turn: a circle's circumference over its diameter.

    Examples

    
    Expect(IsClose(Sin(Pi / 2), 1.0))
    Expect(Tau == 2 * Pi)
    Expect(Pi64 > 3.14159265358 && Pi64 < 3.14159265359)

    std/math/constants.fb, line 19

    Tau const

    Public Const Tau: Float = 6.28318530717958647692

    A turn: 2 Pi.

    std/math/constants.fb, line 21

    E const

    Public Const E: Float = 2.71828182845904523536

    Euler's number, e: the base of the natural logarithm.

    std/math/constants.fb, line 23

    Epsilon const

    Public Const Epsilon: Float = 1.1920929e-7

    The gap between 1 and the next Float above it.

    std/math/constants.fb, line 25

    Pi64 const

    Public Const Pi64: Double = 3.14159265358979323846

    Pi, as a Double.

    std/math/constants.fb, line 28

    Tau64 const

    Public Const Tau64: Double = 6.28318530717958647692

    A turn, 2 Pi, as a Double.

    std/math/constants.fb, line 30

    E64 const

    Public Const E64: Double = 2.71828182845904523536

    Euler's number, e, as a Double.

    std/math/constants.fb, line 32

    Epsilon64 const

    Public Const Epsilon64: Double = 2.220446049250313e-16

    The gap between 1 and the next Double above it.

    std/math/constants.fb, line 34

    Inf const

    Public Const Inf: Float = Float.FromBits(0x7F800000)

    Infinity and not-a-number, which the compiler doesn't work out, so the program does as it starts.

    std/math/constants.fb, line 38

    NaN const

    Public Const NaN: Float = Float.FromBits(0x7FC00000)

    Not a number, which isn't equal to itself, as 0 / 0 gives.

    std/math/constants.fb, line 40

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