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

# fneg

## Operation

Negate `float`

## Format

```
fneg
```

## Forms

*fneg* = 118 (0x76)

## Operand Stack

..., *value* →

..., *result*

## Description

The *value* must be of type `float`. It is popped from the operand stack. The `float` *result* is the arithmetic negation of *value*. The *result* is pushed onto the operand stack.

For `float` 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 `float`.

Special cases of interest:

- If the operand is NaN, the result is NaN (recall that NaN has no sign).

  The Java Virtual Machine has not adopted the stronger requirement from the 2019 version of the IEEE 754 Standard that negation inverts the sign bit for all inputs, including NaN.

- 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.
