min / max / clamp

pub fn min(self: integer, b: integer) -> integer

Each of these has two overloads: one over non-null values (-> τ) and one over nullable ones (-> τ?). You get the nullable overload whenever ANY argument is statically nullable — an integer?/single?/float?, or a division result such as 1 / z — and it propagates: the answer is null if either argument is null. Otherwise you get the non-null overload and a non-null answer, so a plain min(a, b) needs no discharge. Smallest of two integer values.

pub fn max(self: integer, b: integer) -> integer

Largest of two integer values.

pub fn clamp(self: integer, lo: integer, hi: integer) -> integer

Clamps v into the inclusive range [lo, hi]. Returns null if any argument is null.

pub fn min(self: single, b: single) -> single

Smallest of two single-precision float values.

pub fn max(self: single, b: single) -> single

Largest of two single-precision float values.

pub fn clamp(self: single, lo: single, hi: single) -> single

Clamps v into the inclusive range [lo, hi]. Returns null if any argument is null.

pub fn min(self: float, b: float) -> float

Smallest of two double-precision float values.

pub fn max(self: float, b: float) -> float

Largest of two double-precision float values.

pub fn clamp(self: float, lo: float, hi: float) -> float

Clamps v into the inclusive range [lo, hi]. Returns null if any argument is null.

pub fn then(self: Ordering, next: Ordering) -> Ordering

This answer, or next when this one is Equal: compares by several fields in turn, a.year.compare(b.year).then(a.month.compare(b.month)).

pub operator compare(self: integer, other: integer) -> Ordering

Where self stands against other — Less, Equal or Greater — in the order < uses.

pub operator compare(self: single, other: single) -> Ordering

Where self stands against other, in the order < uses.

pub operator compare(self: float, other: float) -> Ordering

Where self stands against other, in the order < uses.

pub operator plus(self: integer, other: integer) -> integer

+ as the method Addable names: a.plus(b) is a + b.

pub operator minus(self: integer, other: integer) -> integer

- as the method Subtractable names: a.minus(b) is a - b.

pub operator times(self: integer, other: integer) -> integer

* as the method Numeric names: a.times(b) is a * b.

pub operator negate(self: integer) -> integer

The unary - as the method Numeric names: a.negate() is -a.

pub operator divided_by(self: integer, other: integer) -> integer?

/ as a method: a.divided_by(b) is a / b, null on a zero divisor.

pub operator remainder(self: integer, other: integer) -> integer?

% as a method: a.remainder(b) is a % b, null on a zero divisor.

pub operator plus(self: single, other: single) -> single

+ as the method Addable names: a.plus(b) is a + b.

pub operator minus(self: single, other: single) -> single

- as the method Subtractable names: a.minus(b) is a - b.

pub operator times(self: single, other: single) -> single

* as the method Numeric names: a.times(b) is a * b.

pub operator negate(self: single) -> single

The unary - as the method Numeric names: a.negate() is -a.

pub operator divided_by(self: single, other: single) -> single?

/ as a method: a.divided_by(b) is a / b, null on a zero divisor.

pub operator remainder(self: single, other: single) -> single?

% as a method: a.remainder(b) is a % b, null on a zero divisor.

pub operator plus(self: float, other: float) -> float

+ as the method Addable names: a.plus(b) is a + b.

pub operator minus(self: float, other: float) -> float

- as the method Subtractable names: a.minus(b) is a - b.

pub operator times(self: float, other: float) -> float

* as the method Numeric names: a.times(b) is a * b.

pub operator negate(self: float) -> float

The unary - as the method Numeric names: a.negate() is -a.

pub operator divided_by(self: float, other: float) -> float?

/ as a method: a.divided_by(b) is a / b, null on a zero divisor.

pub operator remainder(self: float, other: float) -> float?

% as a method: a.remainder(b) is a % b, null on a zero divisor.

pub fn approx(self: float, b: float, eps: float) -> boolean

Approximate equality: true when a and b differ by at most eps (inclusive). == on float/single is EXACT IEEE equality — use approx when you want a tolerance, e.g. comparing computed transcendentals: approx(sqrt(2.0) * sqrt(2.0), 2.0, 1e-9). A null (NaN) operand is not approximately equal to anything, so the result is false.

pub fn approx(self: single, b: single, eps: single) -> boolean

Approximate equality for single-precision floats (see the float overload).