---
title: negate()
framework: swift
role: symbol
role_heading: Instance Method
path: swift/float/negate()
---

# negate()

Replaces this value with its additive inverse.

## Declaration

```swift
mutating func negate()
```

## Discussion

Discussion The result is always exact. This example uses the negate() method to negate the value of the variable x: var x = 21.5 x.negate() // x == -21.5

## See Also

### Performing Calculations

- [Floating-Point Operators for Float](swift/floating-point-operators-for-float.md)
- [addingProduct(_:_:)](swift/float/addingproduct(_:_:).md)
- [addProduct(_:_:)](swift/float/addproduct(_:_:).md)
- [squareRoot()](swift/float/squareroot().md)
- [formSquareRoot()](swift/float/formsquareroot().md)
- [remainder(dividingBy:)](swift/float/remainder(dividingby:).md)
- [formRemainder(dividingBy:)](swift/float/formremainder(dividingby:).md)
- [truncatingRemainder(dividingBy:)](swift/float/truncatingremainder(dividingby:).md)
- [formTruncatingRemainder(dividingBy:)](swift/float/formtruncatingremainder(dividingby:).md)
