Skip to content

aivi.core.float ​

Pure helpers and compiler intrinsics for finite IEEE 754 double-precision values. The MVP keeps general numeric operations here; presentation rounding, percentages, angle wrapping, and curve evaluation belong in application libraries.

0.0 and -0.0 compare equal and address the same map key, including inside compound keys. Their signs are preserved when rendering or serializing values. Runtime deserialization rejects NaN and infinities, just as construction and parseText do.

aivi
use aivi.core.float (
    pi
    e
    tau
    negate
    max
    min
    clamp
    lerp
    sign
    between
    isZero
    isPositive
    isNegative
    square
    toRadians
    toDegrees
    floor
    ceil
    round
    sqrt
    abs
    toInt
    fromInt
    toText
    parseText
    approxEq
)

Constants ​

ValueMeaning
piπ
eEuler's number
tau2π

Pure helpers ​

FunctionTypeBehavior
negateFloat -> FloatFlip the sign
maxFloat -> Float -> FloatReturn the greater value
minFloat -> Float -> FloatReturn the lesser value
clampFloat -> Float -> Float -> FloatRestrict a value to inclusive bounds
lerpFloat -> Float -> Float -> FloatLinear interpolation
signFloat -> FloatReturn -1.0, 0.0, or 1.0
betweenFloat -> Float -> Float -> BoolInclusive range test
isZeroFloat -> BoolTest against 0.0
isPositiveFloat -> BoolTest above zero
isNegativeFloat -> BoolTest below zero
squareFloat -> FloatMultiply a value by itself
toRadiansFloat -> FloatConvert degrees to radians
toDegreesFloat -> FloatConvert radians to degrees
approxEqFloat -> Float -> Float -> BoolapproxEq epsilon a b tests abs (a - b) <= epsilon

Compiler intrinsics ​

FunctionTypeBehavior
floorFloat -> FloatRound down
ceilFloat -> FloatRound up
roundFloat -> FloatRound to the nearest integral value
sqrtFloat -> FloatSquare root
absFloat -> FloatAbsolute value
toIntFloat -> IntTruncate toward zero
fromIntInt -> FloatConvert an integer
toTextFloat -> TextRender decimal text
parseTextText -> Option FloatParse finite decimal text
aivi
use aivi.core.float (
    approxEq
    lerp
    pi
    toRadians
)

value midpoint : Float = lerp 10.0 20.0 0.5
value halfTurn : Bool = approxEq 0.000001 (toRadians 180.0) pi

(c) 2026 by Andreas Herd