Operators

min / max / ≅

Full

Infix operators that pick the smaller or larger value, and compare with tolerance.

Besides the .min/.max methods, min and max are also infix operators that return the lesser or greater of two values. (approximately-equal) compares with a small tolerance — useful for floating point.

min and max #

say 5 min 3;
say 5 max 3;
say 2 min 8 min 5;
Output
3
5
2

They chain, so 2 min 8 min 5 is the smallest of the three.

Approximately-equal — ≅ #

(or its ASCII spelling =~=) is true when two numbers are within a small relative tolerance — the right test for floating-point results that should be "equal" but for rounding.

say (0.1 + 0.2) ≅ 0.3;
say 1.0 ≅ 1.0000001;
Output
True
False

Notes #