Java Virtual Machine (Java Series)

prev next contents
ldiv

divide a long integer

Jasmin Syntax

ldiv Stack

Before

After
value1-word1 result-word1
value1-word2 result-word2
value2-word1 ...
value2-word2
...
Description

Pops the top two two-word long integers from the stack and divides by the top long integer (i.e. computes value2 / value1). The result is rounded to the nearest integer, with rounding going towards 0. The long integer quotient result is pushed back onto the stack.

Exceptions

ArithmeticException - the divisor (value2) is zero.

Bytecode

Type

Description
u1 ldiv opcode = 0x6D (109)
See Also

idiv, fdiv, ddiv

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.


prev next contents
Java Virtual Machine, by Jon Meyer and Troy Downing, O'Reilly Associates

Категории