Calculates the cosine of each element in an array of single-precision values.
SDKs
- iOS 5.0+
- macOS 10.4+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Accelerate
Declaration
func vvcosf(_: Unsafe Mutable Pointer<Float>, _: Unsafe Pointer<Float>, _: Unsafe Pointer<Int32>)
Parameters
parameter 1
The output array, y.
parameter 2
The input array, x.
parameter 3
The number of elements in the arrays.
Discussion
If x
is +/-inf
, the result is Na
.
The following code shows an example of using vvcosf(_:
.
let pi = Float.pi
var x: [Float] = [-pi, 0, pi]
var y = [Float](repeating: 0, count: x.count)
var n = Int32(x.count)
vvcosf(&y, &x, &n)
print(y) // [-1.0, 0.0, 1.0]