Std.Math
Mathematical constants and functions for floating-point arithmetic.
Functions
pi
fun pi : FloatThe ratio of a circle's circumference to its diameter.
e
fun e : FloatEuler's number, the base of the natural logarithm.
tau
fun tau : FloatTwo times pi. The ratio of a circle's circumference to its radius.
sqrt
fun sqrt : Float -> FloatSquare root. Panics on negative input.
pow
fun pow : Float -> Float -> FloatRaises the first argument to the power of the second.
log
fun log : Float -> FloatNatural logarithm (base e). Panics on non-positive input.
log2
fun log2 : Float -> FloatBase-2 logarithm. Panics on non-positive input.
log10
fun log10 : Float -> FloatBase-10 logarithm. Panics on non-positive input.
asin
fun asin : Float -> FloatArcsine in radians. Input must be in [-1, 1].
acos
fun acos : Float -> FloatArccosine in radians. Input must be in [-1, 1].
atan2
fun atan2 : Float -> Float -> FloatTwo-argument arctangent in radians.
exp
fun exp : Float -> FloatExponential function (e raised to the given power).
sin
fun sin : Float -> FloatSine in radians.
cos
fun cos : Float -> FloatCosine in radians.
tan
fun tan : Float -> FloatTangent in radians.
atan
fun atan : Float -> FloatArctangent in radians.
abs
fun abs : Float -> FloatReturns the absolute value.
min
fun min : Float -> Float -> FloatReturns the smaller of two floats.
max
fun max : Float -> Float -> FloatReturns the larger of two floats.
clamp
fun clamp : Float -> Float -> Float -> FloatClamps a value to the range [low, high].
sign
fun sign : Float -> FloatReturns -1.0 for negative, 0.0 for zero, 1.0 for positive.
deg_to_rad
fun deg_to_rad : Float -> FloatConverts degrees to radians.
rad_to_deg
fun rad_to_deg : Float -> FloatConverts radians to degrees.