math module
Maylang standard-library module.
import "math" as math;
Module note — Integer division truncates toward zero; average and even-length median on integer inputs may therefore truncate. Use floating inputs or stats_mean/stats_median for fractional results.
Functions
square
fun square(x: Any) -> AnyNo description yet. Read the declaration source for the exact contract.
supported · full runtime · source
cube
fun cube(x: Any) -> AnyNo description yet. Read the declaration source for the exact contract.
supported · full runtime · source
clamp
fun clamp<T>(x: T, lo: T, hi: T) -> TNo description yet. Read the declaration source for the exact contract.
supported · full runtime · source
gcd
fun gcd(a: Int, b: Int) -> IntNo description yet. Read the declaration source for the exact contract.
supported · full runtime · source
lcm
fun lcm(a: Int, b: Int) -> IntNo description yet. Read the declaration source for the exact contract.
supported · full runtime · source
is_prime
fun is_prime(n: Int) -> BoolNo description yet. Read the declaration source for the exact contract.
supported · full runtime · source
factorial
fun factorial(n: Int) -> IntNo description yet. Read the declaration source for the exact contract.
supported · full runtime · source
fibonacci
fun fibonacci(n: Int) -> IntNo description yet. Read the declaration source for the exact contract.
supported · full runtime · source
average
fun average(xs: Any) -> AnyNo description yet. Read the declaration source for the exact contract.
supported · full runtime · source
median
fun median(xs: Any) -> AnyNo description yet. Read the declaration source for the exact contract.
supported · full runtime · source
degrees
fun degrees(radians_of: Float) -> FloatNo description yet. Read the declaration source for the exact contract.
supported · full runtime · source
radians
fun radians(degrees_of: Float) -> FloatNo description yet. Read the declaration source for the exact contract.
supported · full runtime · source
distance
fun distance(x1: Float, y1: Float, x2: Float, y2: Float) -> FloatNo description yet. Read the declaration source for the exact contract.
supported · full runtime · source
is_power_of_two
fun is_power_of_two(n: Int) -> BoolNo description yet. Read the declaration source for the exact contract.
supported · full runtime · source