ldiv

Operation
Divide long

ldiv

Forms
ldiv = 109 (0x6d)

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.

A long division rounds towards 0; that is, the quotient produced for long values in n / d is a long value q whose magnitude is as large as possible while satisfying . Moreover, q is positive when and n and d have the same sign, but q is negative when and n and d have opposite signs.

There is one special case that does not satisfy this rule: if the dividend is the negative integer of largest possible magnitude for the long type and the divisor is -1, then overflow occurs and the result is equal to the dividend; despite the overflow, no exception is thrown in this case.

Runtime Exception
If the value of the divisor in a long division is 0, ldiv throws an ArithmeticException.