...
Consequently, in implementations that do not allow for the representation of all numbers, conversions of numbers values between zero and FLT_MIN
may result in undefined behavior.
...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <limits.h>
void func(float f_a) {
int i_a;
if (f_a >= (float)INT_MAX || f_a < (float)INT_MIN || (f_a >= 0F && f_a < FLT_MIN)) {
/* Handle error */
} else {
i_a = f_a;
}
} |
...