> module
std::math
mathematical functions
use std::math; in the browser
std::math provides floating-point maths, a few integer helpers, and constants. Angles are in radians. Constants are functions: math::PI().
> functions
The angle of the point (x, y) from the positive x axis, in [-pi, pi].
val limited to the range [min, max]. min greater than max, or either of them NaN, is a runtime error.
The smaller or larger of two floats. If one is NaN, the other is returned.
The smaller or larger of two floats. If one is NaN, the other is returned.
> examples
use std::math;
use std::io;
fn main() {
io::println("sqrt(9) = {}", math::sqrt(9.0));
io::println("2^10 = {}", math::pow(2.0, 10.0));
io::println("{}", math::clamp(1.5, 0.0, 1.0)); // 1
io::println("{}", math::sin(math::PI() / 2.0)); // 1
}