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

may
fun square(x: Any) -> Any

No description yet. Read the declaration source for the exact contract.

supported · full runtime · source

cube

may
fun cube(x: Any) -> Any

No description yet. Read the declaration source for the exact contract.

supported · full runtime · source

clamp

may
fun clamp<T>(x: T, lo: T, hi: T) -> T

No description yet. Read the declaration source for the exact contract.

supported · full runtime · source

gcd

may
fun gcd(a: Int, b: Int) -> Int

No description yet. Read the declaration source for the exact contract.

supported · full runtime · source

lcm

may
fun lcm(a: Int, b: Int) -> Int

No description yet. Read the declaration source for the exact contract.

supported · full runtime · source

is_prime

may
fun is_prime(n: Int) -> Bool

No description yet. Read the declaration source for the exact contract.

supported · full runtime · source

factorial

may
fun factorial(n: Int) -> Int

No description yet. Read the declaration source for the exact contract.

supported · full runtime · source

fibonacci

may
fun fibonacci(n: Int) -> Int

No description yet. Read the declaration source for the exact contract.

supported · full runtime · source

average

may
fun average(xs: Any) -> Any

No description yet. Read the declaration source for the exact contract.

supported · full runtime · source

median

may
fun median(xs: Any) -> Any

No description yet. Read the declaration source for the exact contract.

supported · full runtime · source

degrees

may
fun degrees(radians_of: Float) -> Float

No description yet. Read the declaration source for the exact contract.

supported · full runtime · source

radians

may
fun radians(degrees_of: Float) -> Float

No description yet. Read the declaration source for the exact contract.

supported · full runtime · source

distance

may
fun distance(x1: Float, y1: Float, x2: Float, y2: Float) -> Float

No description yet. Read the declaration source for the exact contract.

supported · full runtime · source

is_power_of_two

may
fun is_power_of_two(n: Int) -> Bool

No description yet. Read the declaration source for the exact contract.

supported · full runtime · source