Divide long
Bytecode
Type | Description |
u1 | ldiv opcode = 0x6D (109) |
Stack ..., value1.word1, value1.word2, value2.word1, value2.word2 => ..., result.word1, result.word2
Description
Both value1 and value2 must be of type long
. The values are
popped from the operand stack. The long
result is the value of the
Java expression value1 / value2. The result is pushed onto the
operand stack. The result is rounded to the nearest integer, with rounding going towards
0.
Exceptions
ArithmeticException - the divisor (value2) is zero.
Notes
Because of the two's-complement representation used for negative numbers, dividing Long.MIN_VALUE by -1 produces Long.MIN_VALUE, not Long.MAX_VALUE as you might expect.