Expand description
Numeric helper utilities
Functionsยง
- approx_
eq - Approximately equal for f64 within epsilon
- cross_
product - 3D cross product
- degrees_
to_ radians - Convert degrees to radians
- dot_
product - Dot product of two vectors
- euclidean_
distance - Euclidean distance between equal-length vectors
- factorial
- Factorial for n up to 20 (fits in u128)
- fibonacci
- n-th Fibonacci number (F(0)=0)
- gcd_u64
- Greatest common divisor (Euclidean algorithm)
- is_even
- True if n is even
- is_odd
- True if n is odd
- is_
prime - Check primality by trial division
- lcm_u64
- Least common multiple
- lerp
- Linear interpolation between a and b by t in [0,1]
- manhattan_
distance - Manhattan distance between equal-length vectors
- map_
range - Map value from one range to another
- next_
prime - Next prime greater than or equal to n
- normalize
- Normalize x to [0,1] given min and max
- prev_
prime - Previous prime strictly less than n
- radians_
to_ degrees - Convert radians to degrees
- sigmoid
- Logistic sigmoid function
- signum_
zero - Signum with zero for integers
- sum_
i64_ saturating - Saturating sum for i64 slice