NormalisableRange::clampTo0To1 assert

I’ve never got the point of this assert. Most conversion functions will give out of range outputs for out of range inputs, I’d assume clampTo0To1 is there precisely to deal with it. But then it complains about it, which makes its existence kind of moot. Say I have a mouse drag and something like

auto proportion = startProportion + (position - startPosition) / pixelRange;
setValue (normRange.convertFrom0to1 (proportion));

An out of range position will give an out of range proportion, but then to avoid the assert I must write

setValue (normRange.convertFrom0to1 (jlimit (0, 1, proportion)));

I know it’s a quibble, but still… isn’t it redundant?

1 Like

Same remark few years later…