Min v0.1.0

Source
Returns the smaller of two values.

Package: Math

Signature

func Min(a: float64, b: float64) -> float64;
func Min(a: float32, b: float32) -> float32;

Parameters

NameTypeDescription
afloat64 / float32The first value.
bfloat64 / float32The second value.

Returns

The smaller of a and b. A NaN loses to anything else — Min(NaN, y) is y and Min(x, NaN) is x — and only two NaNs produce a NaN. When a and b compare equal, the sign of a zero still decides: Min(0.0, -0.0) is -0.0.

Example

import Math::Min;

func Main() -> int {
    let a = Min(3.0, 7.0);  // 3.0
    let b = Min(0.0, -0.0); // -0.0
    return 0;
}

See also

  • Math — the package overview
  • Max — the smaller value's counterpart
  • Abs — magnitude of a single value