Java arithmetic instruction

De Software testing
Ir para: navegação, pesquisa

Concepts


Facts

  • There are two main kinds of Java arithmetic instructions: those operating on integer values and those operating on floating-point values. <bib>lindholm-yellin:1999</bib>
  • There is no direct support for integer arithmetic on values of the byte, short, char, or boolean type; those operations are handled by instructions operating on type int. <bib>lindholm-yellin:1999</bib>
  • Integer and floating-point instructions differ in their behavior on overflow and divide-by-zero. <bib>lindholm-yellin:1999</bib>
  • The Java virtual machine does not indicate overflow during Java arithmetic instructions, but integer divide instructions (idiv and ldiv) and integer remainder instructions (irem and lrem), which throw an ArithmeticException if the divisor is zero. <bib>lindholm-yellin:1999</bib>
  • Java virtual machine operates Java arithmetic instructions on floating-point numbers as specified in IEEE 754, requiring denormalized floating-point numbers, gradual underflow, and using the rounding mode known as round to nearest mode for floats and round towards zero when converting a floating-point value to an integer. <bib>lindholm-yellin:1999</bib>