The std::math module provides hardware-accelerated mathematical primitives, trigonometry, logarithms, and floating-point conversions.
Calculates the principal square root of x.
let s = sqrt(144.0); # 12.0
Calculates base raised to the power exp.
let p = pow(2.0, 10.0); # 1024.0
Returns the absolute value of x.
let a = abs(-42); # 42
Returns the largest integer less than or equal to x.
let f = floor(3.9); # 3
Returns the smallest integer greater than or equal to x.
let c = ceil(3.1); # 4
Rounds float to the nearest integer.
let r = round(3.5); # 4
Trigonometric operations (angle in radians).
let s = sin(1.57079632679); # ~1.0
Returns the minimum or maximum of two values.
let m = max(10, 25); # 25