---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 16 Edition"
java_version: 16
chapter: "Chapter 6. The Java Virtual Machine Instruction Set"
section: "6.5.dneg"
heading: "dneg"
parent: "6.5. Instructions"
source: https://docs.oracle.com/javase/specs/jvms/se16/html/jvms-6.html#jvms-6.5.dneg
id: "6.5.dneg"
url: https://jvm.obfuscated.software/jvms/se16/6.5.dneg.html
raw: https://jvm.obfuscated.software/jvms/se16/6.5.dneg.md
---

# dneg

## Operation

Negate `double`

## Format

```
dneg
```

## Forms

*dneg* = 119 (0x77)

## Operand Stack

..., *value* →

..., *result*

## Description

The value must be of type `double`. It is popped from the operand stack and undergoes value set conversion ([§2.8.3](2.8.3.md)), resulting in *value*'. The `double` *result* is the arithmetic negation of *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:

- If the operand is NaN, the result is NaN (recall that NaN has no sign).
- If the operand is an infinity, the result is the infinity of opposite sign.
- If the operand is a zero, the result is the zero of opposite sign.
