-Wfloat-equal and comparison to zero

Thomas Koenig tkoenig@netcologne.de
Tue Nov 12 17:23:41 GMT 2024


Am 12.11.24 um 17:25 schrieb Michael Matz via Gcc:

> If you think of float as
> approximated reals, then yes, division by zero is undefined (not
> somewhat undefined!).

Depends on how you look at it.

IEEE 754-2008, for example, says in 7.3

"The default result of divideByZero shall be an ∞ correctly signed 
according to the operation:

- For division, when the divisor is zero and the dividend is a finite
   non-zero number, the sign of the infinity is the exclusive OR of the
   operands’ signs (see 6.3)"

What may be undefined according to a language standard may become
defined by additional standards like IEEE, if they apply.

Best regards

	Thomas



More information about the Gcc mailing list