Math
Also known as: math sqrt pow power floor ceil round pi gcd prime absolute
● Beginner3 minBefore this: OperatorsSpec 14.5
std.math has square roots, powers, rounding, pi and more.
use std.math
fn main() {
print(math.sqrt(16.0))
print(math.pow(2.0, 0.5))
print(math.gcd(12, 18))
print(math.is_prime(97))
print(math.pi)
}The program ran and printed:
kavach run functions.kav
4.01.41421356237309516true3.141592653589793
Start the file with use std.math, then call each function as math.name(…).