c++ - In IEEE float implementation when an Overflow leads to INF, is it considered as undefined bahavior? -


it's in title. example if addition of 2 floats results in inf, generate undefined behavior? or avoided in ieee float implementation?

no. there no undefined behavior in ieee-754 arithmetic. result defined infinity example in question, , defined set flag indicating overflow occurred.

the room undefined behavior if platform in question doesn't adhere ieee-754. (c , c++ do not require floating-point arithmetic follows ieee-754)


Comments