In general there are situations when this kind of type unstable code is needed:
f() = rand() < 0.5 ? 1 : 1.0
The typical example is that you read data from an external source and do not know its type at compile time.
3 Likes