Built-in method to clip SimpleNumber between min and max?

This should be obvious but I don’t find it… is there a built-in method to clip a SimpleNumber between a minimum and maximum value? I can easily write a function to do it, but given how many exotic operators are defined on SimpleNumber, I’d be surprised if something as basic as this was not provided.

How about 11.clip(0, 10)

That might work :slight_smile: I searched all methods for SimpleNumber and only found .clip2 (which is not what I needed). But Integer and Float apparently document (or rather do not document, but list) a method .clip.
A bit confusing, but good enough. Any idea why .clip is not defined on SimpleNumber by any chance?

Perhaps the implementations are different for Integer and Float. I’d be willing to bet that they dispatch to primitives, which would have to be type-specific.