drem 0x73
Takes the remainder of two doubles on top of the stack; pushes the result.
- Opcode
0x73(115)- Family
- Arithmetic and bitwise
- Operands
- none
- Length
- 1 byte
- Operand stack
…, value1 (double), value2 (double) → …, result (double)- Can throw
- nothing at run time (beyond linking errors)
What it does
a % b on two doubles: pops b, then a, and pushes the result.
The remainder truncates toward zero, like C's fmod, not IEEE 754's remainder (which Math.IEEEremainder computes). javac emits it for % on doubles, which is rare in practice.
How often javac uses it
In JDK 25.0.5's java.base module, drem appears 1 times in 1 of its 7,391 classes: <0.01% of all instructions, the 193rd most common of 194 opcodes in use. Some of the methods that use it: java.text.CompactNumberFormat.evalLOperand.
Example
From the sample classes, compiled by javac 25 with -g. Each Java line is shown above the bytecode it compiled to; drem is highlighted.
static double doubles(double a, double b) in Tour, compiled by javac 25Related instructions
irem Takes the remainder of two ints on top of the stack; pushes the result.lrem Takes the remainder of two longs on top of the stack; pushes the result.frem Takes the remainder of two floats on top of the stack; pushes the result.
Specification: JVMS §6.5, drem (Java SE 25).