dcmpg :
compare two doubles (1 on NaN) : index : visitInsn()
- Description
- This takes two double-precision floating point numbers off the operand
stack and compares them, using IEEE 754 rules.
If the two numbers are the same, the int 0 is pushed onto the stack. If
value2 is greater than value1, the int 1 is pushed onto the
stack. If value1 is greater than value2, -1 is pushed onto the
stack. If either numbers is NaN, the int 1 is pushed onto the stack. +0.0 and
-0.0 are treated as equal. - Example
dload_1 ; push the double in local variable 1
dconst_0 ; push the double 0.0 onto the stack
dcmpg ; compare the two numbers
; The integer result on the stack is:
; 0 if local variable 1 equals 0
; -1 if local variable 1 is less than 0
; 1 if local variable 1 is greater than 0
- Notes
- This instruction is identical to dcmpl except for the treatment
of NaN.
- See also
- lcmp fcmpl fcmpg dcmpl
- Stack
Before
|
After |
value1-word1 |
int-result |
value1-word2 |
... |
value2-word1 |
... |
value2-word2 |
... |
... |
... |
- Bytecode
Type
|
Description |
u1
|
dcmpg
opcode = 0x98 (152)
|