---
title: negate()
framework: swift
role: symbol
role_heading: Instance Method
path: swift/double/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 Double](swift/floating-point-operators-for-double.md)
- [addingProduct(_:_:)](swift/double/addingproduct(_:_:).md)
- [addProduct(_:_:)](swift/double/addproduct(_:_:).md)
- [squareRoot()](swift/double/squareroot().md)
- [formSquareRoot()](swift/double/formsquareroot().md)
- [remainder(dividingBy:)](swift/double/remainder(dividingby:).md)
- [formRemainder(dividingBy:)](swift/double/formremainder(dividingby:).md)
- [truncatingRemainder(dividingBy:)](swift/double/truncatingremainder(dividingby:).md)
- [formTruncatingRemainder(dividingBy:)](swift/double/formtruncatingremainder(dividingby:).md)
