What operations can make floats leave a [0, 1] range?
Restricting this answer to IEEE754 if I may.
2 can all be represented exactly as a
float. The arithmetic operators are required to return the best floating point value possible. Since
y are neither greater than 1, their sum cannot be greater than 2 since then otherwise there would exist a better
float for the sum. Put another way, the sum of two
floats a little less than
1 cannot be greater than
The same applies to the product.
The third one requires a clamp since there are no guarantees that
std::pow(x, y) returns the best possible