Reputation: 675
It's all in the Title. For example if the addition of two floats results in INF, does it generate an undefined behavior? or is this avoided in IEEE float implementation?
Upvotes: 0
Views: 229
Reputation: 106167
No. There is no undefined behavior in IEEE-754 arithmetic. The result is defined to be infinity for the example in question, and it is defined to set a flag indicating that overflow occurred.
The only room for undefined behavior is if the platform in question doesn't adhere to IEEE-754. (C and C++ do not require that floating-point arithmetic follows IEEE-754)
Upvotes: 4