dneg

Negate double

Bytecode

Type Description
u1 dneg opcode = 0x77 (119)

Stack ..., value.word1, value.word2 => ..., result.word1, result.word2

Description
Removes the top double-precision float from the operand stack, negates it (i.e. inverts its sign), and pushes the negated result back onto the stack.

Note that, in IEEE double precision floating point arithmetic, negation is not quite the same as subtracting from 0. IEEE has two zeros, +0.0 and -0.0, and dneg applied to +0.0 is -0.0, whereas (+0.0 minus +0.0) is +0.0.

The value must be of type double. It is popped from the operand stack. The double result is the arithmetic negation of value, namely -value. The result is pushed onto the operand stack.

For double values, negation is not the same as subtraction from zero. If x is +0.0, then 0.0-x equals +0.0, but -x equals -0.0. Unary minus merely inverts the sign of a double.

Special cases of interest: