...
This rule does not apply to demotions of floating point types on implementations that support signed infinity, such as IEEE 754, as all numbers are representable.
...
Noncompliant Code Example (int-float)
The following non-compliant noncompliant code leads to undefined behavior if the integral part of f1
cannot be represented as an integer.
...
Code Block | ||
---|---|---|
| ||
float f1; int i1; /* initializations */ if (f1 > (float) INT_MAX || f1 < (float) INT_MIN) { /* Handle Error */ } else { i1 = f1; } |
...
Noncompliant Code Example (demotions)
The following non-compliant noncompliant code shows casts of values that may not be outside of the range of the demoted type.
...