Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

If a double is demoted to a float or a long double is demoted to a double or a float, and the initial value exceeds the maximum of the demoted type, then the value of the result undefined.

...

In the assignments above, it is possible that the variable "d1" exceeds the maximum value that can be stored by a float or that the variable "ld" exceeds the maximum value that can be stored in represented as either a float or a double.  One cannot make any assumptions about the value stored if the value is too large to be represented.

Compliant Code Example

This compliant code properly checks to see whether the values to be stored are too large to be represented.

...