Java Virtual Machine (Java Series)

prev next contents
drem

remainder of two doubles

Jasmin Syntax

drem Stack

Before

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

Pops two double-precision numbers off the operand stack, divides by the top double, computes the remainder and pushes the double-precision result back onto the stack. This is like the C function fmod. The remainder is computed using the equation:

remainder = value2 - (intof( value2 / value1 ) * value1)

where intof () rounds towards the nearest integer, or towards the nearest even integer if the number is half way between two integers.

Bytecode

Type

Description
u1 drem opcode = 0x73 (115)
See Also

irem, frem, lrem

Notes

1. Divide by zero will result in NaN being pushed onto the stack as the result.

2. This operation is not the same as the IEEE-defined remainder operation, which uses slightly different rules for rounding. Use the Java library routine Math.IEEEremainder if you want the IEEE behavior.


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

Категории