---
title: "absolute(_:)"
framework: accelerate
role: symbol
role_heading: Type Method
path: "accelerate/vdsp/absolute(_:)-5ehc1"
---

# absolute(_:)

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

## Declaration

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

## Parameters

- `vector`: The source vector.

## Discussion

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

## See Also

### Vector absolute functions

- [absolute(_:)](accelerate/vdsp/absolute(_:)-9c3ge.md)
- [absolute(_:result:)](accelerate/vdsp/absolute(_:result:)-4pigo.md)
- [absolute(_:result:)](accelerate/vdsp/absolute(_:result:)-657bd.md)
