In my opinion both the assertion and the clamping are bad because values outside $[0,1]$ are physically plausible (at least if they are in linearised sRGB). Values larger than 1 correspond to brighter light and values smaller than 0 correspond to wide-gamut colours, i.e. colours outside the sRGB gamut.
In my opinion both the assertion and the clamping are bad because values outside $[0,1]$ are physically plausible (at least if they are in linearised sRGB). Values larger than 1 correspond to brighter light and values smaller than 0 correspond to wide-gamut colours, i.e. colours outside the sRGB gamut.
What is the purpose of the replacement?