Versions Compared

Key

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

...

Widening conversions resulting from integer promotions preserve the overall magnitude of the number. However, promotions in which the operands are converted from an int to a float or from a long to a double can cause unexpected loss of precision. (See guideline FLP10-J. Do not cast primitive integer types Beware of precision lost when casting primitive integers to floating-point types without range checks for more details.)

These conversions can happen with the following operators: multiplicative operators (%, *, /), additive operators (+, -), comparison operators (<, >, <=, >=), equality operators (==, !=) and the integer bitwise operators (&, |, ^).

...