Versions Compared

Key

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

Using integer arithmetic to calculate a value for assignment to a floating point variable may lead to loss of information. This can be avoided by converting one of the integers in the expression to a floating type.

When converting integers to floating point and vice versa, it is important to carry out proper range checks in order to avoid undefined behavior (see FLP34-C. Ensure that floating point conversions are within range of the new type).

Non-Compliant Code Example

...