---
title: "negative(_:)"
framework: accelerate
role: symbol
role_heading: Type Method
path: "accelerate/vdsp/negative(_:)-8mo1p"
---

# negative(_:)

Returns the negative value of each element in the supplied single-precision vector.

## Declaration

```swift
static func negative<U>(_ vector: U) -> [Float] where U : AccelerateBuffer, U.Element == Float
```

## Parameters

- `vector`: The source vector.

## Discussion

Discussion For example, the following code calculates the negative values of the elements of an array:     let values: [Float] = [-1, 2, -3, 4, -5, 6, -7, 8]          let negativeValues = vDSP.negative(values)          // Prints "[1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0]".     print(negativeValues)

## See Also

### Vector negation functions

- [negative(_:)](accelerate/vdsp/negative(_:)-24oe4.md)
- [negative(_:result:)](accelerate/vdsp/negative(_:result:)-92caw.md)
- [negative(_:result:)](accelerate/vdsp/negative(_:result:)-5bwqv.md)
