Math

Functions for numeric computation. All trigonometric functions work in radians. Both single and float variants exist for every function — choose single for speed, float for precision. Integer operations

pub fn abs(both: integer) -> integer

Absolute value. Removes the sign from a negative integer.

pub fn abs(both: long) -> long

Absolute value for long integers.

pub fn abs(both: single) -> single

Absolute value for single-precision floats.

pub fn cos(both: single) -> single

Cosine. Use for circular motion: x = r * cos(angle).

pub fn sin(both: single) -> single
pub fn tan(both: single) -> single
pub fn acos(both: single) -> single
pub fn asin(both: single) -> single
pub fn atan(both: single) -> single
pub fn ceil(both: single) -> single
pub fn floor(both: single) -> single
pub fn round(both: single) -> single
pub fn sqrt(both: single) -> single
pub fn atan2(both: single, v2: single) -> single

Arc tangent of y/x, preserving the correct quadrant. Use instead of atan when you have separate x/y components.

pub fn log(both: single, v2: single) -> single
pub fn pow(both: single, v2: single) -> single

Raises base to the power exp. Use for exponential growth curves and scaling.

pub fn abs(both: float) -> float

Absolute value for double-precision floats.

pub PI = OpMathPiFloat()

The ratio of a circle's circumference to its diameter (3.14159...).

pub E = OpMathEFloat()

Euler's number, the base of natural logarithms (2.71828...).

pub fn cos(both: float) -> float

Cosine. Use for circular motion: x = r * cos(angle).

pub fn sin(both: float) -> float
pub fn tan(both: float) -> float
pub fn acos(both: float) -> float
pub fn asin(both: float) -> float
pub fn atan(both: float) -> float
pub fn ceil(both: float) -> float
pub fn floor(both: float) -> float
pub fn round(both: float) -> float
pub fn sqrt(both: float) -> float
pub fn atan2(both: float, v2: float) -> float

Arc tangent of y/x, preserving the correct quadrant. Use instead of atan when you have separate x/y components.

pub fn log(both: float, v2: float) -> float
pub fn pow(both: float, v2: float) -> float

Raises base to the power exp. Use for exponential growth curves and scaling.