Module auto-imported

prelude::math

Scalar functions take and return float and follow IEEE-754: an invalid input gives NaN and an overflow gives infinity, never a panic. Powers and remainders are the ** and % operators, not functions.

The linear-algebra helpers work on fixed-size arrays ([float; 3], [[float; 2]; 2]) and check shapes at compile time.

For integer helpers (abs, gcd, clamp, …) and constants such as PI, see the stdlib num module; for overflow-aware integer powers, arith.

Built into the compiler.

Types#

NameDescription
MatrixA matrix: nested fixed-length numeric rows with matrix operators.

Functions#

NameDescription
sinReturns the sine of x (in radians).
cosReturns the cosine of x (in radians).
tanReturns the tangent of x (in radians).
sqrtReturns the square root of x.
floorReturns the largest whole number less than or equal to x, as a float.
ceilReturns the smallest whole number greater than or equal to x, as a float.
expReturns e raised to the power x.
lnReturns the natural logarithm of x.
atanReturns the arctangent of x, in radians in -pi/2..=pi/2.
atan2Returns the angle of the point (x, y) from the positive x axis, in radians in -pi..=pi.
asinReturns the arcsine of x, in radians in -pi/2..=pi/2.
acosReturns the arccosine of x, in radians in 0..=pi.
log10Returns the base-10 logarithm of x.
log2Returns the base-2 logarithm of x.
cbrtReturns the cube root of x.
sinhReturns the hyperbolic sine of x.
coshReturns the hyperbolic cosine of x.
tanhReturns the hyperbolic tangent of x.
dotReturns the dot product of two vectors of the same length.
crossReturns the cross product of two 3-element vectors.
matmulMultiplies two matrices written as nested fixed-length arrays.
matrixWraps nested fixed-length rows as a Matrix.
intersectReturns a byte mask that is 1 where both matrices have a non-zero cell.
diffReturns a byte mask that is 1 where a has a non-zero cell and b has 0.
↑ ↓ navigate ↵ open