<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vvcos(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@vvcos"
  },
  "title" : "vvcos(_:_:_:)"
}
-->

# vvcos(_:_:_:)

Calculates the cosine of each element in an array of double-precision values.

```
func vvcos(_: UnsafeMutablePointer<Double>, _: UnsafePointer<Double>, _: UnsafePointer<Int32>)
```

## Discussion

### Parameters:

- parameter 1: The output array, *y*.
- parameter 2: The input array, *x*.
- parameter 3: The number of elements in the arrays.

If `x` is `+/-inf`, the result is `NaN`.

The following code shows an example of using [`vvcos(_:_:_:)`](/documentation/Accelerate/vvcos(_:_:_:)).

```swift
let pi = Double.pi
var x: [Double] = [-pi, 0, pi]
var y = [Double](repeating: 0, count: x.count)
var n = Int32(x.count)
 
vvcos(&y, &x, &n)
 
print(y) // [-1.0, 0.0, 1.0]
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)