clamp method
Clamps this to min..max.
NOTE: num already declares clamp and an instance member always wins
over an extension member, so n.clamp(min, max) calls num.clamp.
This is only reachable as NumExtension(n).clamp(min, max).
Implementation
num clamp(num min, num max) {
if (this < min) {
return min;
} else if (this > max) {
return max;
} else {
return this;
}
}