---
title: vForce
framework: accelerate
role: collectionGroup
role_heading: API Collection
path: accelerate/vforce-library
---

# vForce

Perform transcendental and trigonometric functions on vectors of any length.

## Overview

Overview The vForce library provides a range of trigonometric and transcendental functions that work over large collections of single- and double-precision values. The collections can be of any length, and vForce supplies vectorized functions for the current architecture. The functions declared in the vForce library have the customary mathematical names, but with the prefix vv, for example, vvsqrtf(_:_:_:). Each mathematical function is available in two variants: one for single-precision data and one for double-precision data. The single-precision forms have the suffix f, whereas the double-precision forms have no suffix. For example, vvcosf(_:_:_:) is the single-precision cosine function, and vvcos(_:_:_:) is the double-precision variant. All of the vForce library functions follow a common format: The return type is void. The first parameter points to an array to hold the results. The only exceptions are vvsincosf(_:_:_:_:) and vvsincos(_:_:_:_:), which have two result arrays that the first two parameters point to. One or more parameters point to operand arrays that are the same length as the result array. The last parameter is the array length. note: Unless otherwise mentioned, vForce functions work in-place. That is, the input may exactly equal the output. Using vForce The vForce library provides a high-performance alternative to for loops and map(_:) when applying operations on arrays of floating-point values. For example, given an arbitrarily sized array, x, that contains single-precision values, the following code uses map(_:) to create a second array, y. On return, y contains the square root of each array element. let n = 10_000

let x = (0..<n).map { _ in     Float.random(in: 1 ... 10_000) }

let y = x.map {     return sqrt($0) } The equivalent functionality implemented in vForce runs significantly faster: let y = [Float](unsafeUninitializedCapacity: n) { buffer, initializedCount in     vForce.sqrt(x,                 result: &buffer)          initializedCount = n }

## Topics

### Swift Overlay

- [vForce](accelerate/vforce.md)

### Array-Oriented Arithmetic and Auxiliary Functions

- [ceil(_:)](accelerate/vforce/ceil(_:)-9dsdt.md)
- [ceil(_:)](accelerate/vforce/ceil(_:)-57grr.md)
- [ceil(_:result:)](accelerate/vforce/ceil(_:result:)-4wev4.md)
- [ceil(_:result:)](accelerate/vforce/ceil(_:result:)-6zm3u.md)
- [copysign(magnitudes:signs:)](accelerate/vforce/copysign(magnitudes:signs:)-s0r3.md)
- [copysign(magnitudes:signs:)](accelerate/vforce/copysign(magnitudes:signs:)-3jhf0.md)
- [copysign(magnitudes:signs:result:)](accelerate/vforce/copysign(magnitudes:signs:result:)-3zoya.md)
- [copysign(magnitudes:signs:result:)](accelerate/vforce/copysign(magnitudes:signs:result:)-5umya.md)
- [floor(_:)](accelerate/vforce/floor(_:)-64hyu.md)
- [floor(_:)](accelerate/vforce/floor(_:)-5awna.md)
- [floor(_:result:)](accelerate/vforce/floor(_:result:)-61veb.md)
- [floor(_:result:)](accelerate/vforce/floor(_:result:)-4mf4q.md)
- [nearestInteger(_:)](accelerate/vforce/nearestinteger(_:)-5mppu.md)
- [nearestInteger(_:)](accelerate/vforce/nearestinteger(_:)-386dx.md)
- [nearestInteger(_:result:)](accelerate/vforce/nearestinteger(_:result:)-bbtt.md)
- [nearestInteger(_:result:)](accelerate/vforce/nearestinteger(_:result:)-1izut.md)
- [reciprocal(_:)](accelerate/vforce/reciprocal(_:)-555of.md)
- [reciprocal(_:)](accelerate/vforce/reciprocal(_:)-8lozf.md)
- [reciprocal(_:result:)](accelerate/vforce/reciprocal(_:result:)-pvu0.md)
- [reciprocal(_:result:)](accelerate/vforce/reciprocal(_:result:)-7hu7a.md)
- [remainder(dividends:divisors:)](accelerate/vforce/remainder(dividends:divisors:)-5rcri.md)
- [remainder(dividends:divisors:)](accelerate/vforce/remainder(dividends:divisors:)-j4a5.md)
- [remainder(dividends:divisors:result:)](accelerate/vforce/remainder(dividends:divisors:result:)-bj3f.md)
- [remainder(dividends:divisors:result:)](accelerate/vforce/remainder(dividends:divisors:result:)-31qe5.md)
- [rsqrt(_:)](accelerate/vforce/rsqrt(_:)-9gm1h.md)
- [rsqrt(_:)](accelerate/vforce/rsqrt(_:)-2xjyq.md)
- [rsqrt(_:result:)](accelerate/vforce/rsqrt(_:result:)-9vniv.md)
- [rsqrt(_:result:)](accelerate/vforce/rsqrt(_:result:)-6o0ky.md)
- [sqrt(_:)](accelerate/vforce/sqrt(_:)-7ze6m.md)
- [sqrt(_:)](accelerate/vforce/sqrt(_:)-8wla9.md)
- [sqrt(_:result:)](accelerate/vforce/sqrt(_:result:)-2ixfw.md)
- [sqrt(_:result:)](accelerate/vforce/sqrt(_:result:)-63m91.md)
- [trunc(_:)](accelerate/vforce/trunc(_:)-11ss3.md)
- [trunc(_:)](accelerate/vforce/trunc(_:)-5wx8z.md)
- [trunc(_:result:)](accelerate/vforce/trunc(_:result:)-8luud.md)
- [trunc(_:result:)](accelerate/vforce/trunc(_:result:)-4xeiu.md)
- [truncatingRemainder(dividends:divisors:)](accelerate/vforce/truncatingremainder(dividends:divisors:)-11bh4.md)
- [truncatingRemainder(dividends:divisors:)](accelerate/vforce/truncatingremainder(dividends:divisors:)-9ofow.md)
- [truncatingRemainder(dividends:divisors:result:)](accelerate/vforce/truncatingremainder(dividends:divisors:result:)-6forr.md)
- [truncatingRemainder(dividends:divisors:result:)](accelerate/vforce/truncatingremainder(dividends:divisors:result:)-23mq2.md)
- [vvceil(_:_:_:)](accelerate/vvceil(_:_:_:).md)
- [vvceilf(_:_:_:)](accelerate/vvceilf(_:_:_:).md)
- [vvfloor(_:_:_:)](accelerate/vvfloor(_:_:_:).md)
- [vvfloorf(_:_:_:)](accelerate/vvfloorf(_:_:_:).md)
- [vvcopysign(_:_:_:_:)](accelerate/vvcopysign(_:_:_:_:).md)
- [vvcopysignf(_:_:_:_:)](accelerate/vvcopysignf(_:_:_:_:).md)
- [vvdiv(_:_:_:_:)](accelerate/vvdiv(_:_:_:_:).md)
- [vvdivf(_:_:_:_:)](accelerate/vvdivf(_:_:_:_:).md)
- [vvfabs(_:_:_:)](accelerate/vvfabs(_:_:_:).md)
- [vvfabsf(_:_:_:)](accelerate/vvfabsf(_:_:_:).md)
- [vvfmod(_:_:_:_:)](accelerate/vvfmod(_:_:_:_:).md)
- [vvfmodf(_:_:_:_:)](accelerate/vvfmodf(_:_:_:_:).md)
- [vvremainder(_:_:_:_:)](accelerate/vvremainder(_:_:_:_:).md)
- [vvremainderf(_:_:_:_:)](accelerate/vvremainderf(_:_:_:_:).md)
- [vvint(_:_:_:)](accelerate/vvint(_:_:_:).md)
- [vvintf(_:_:_:)](accelerate/vvintf(_:_:_:).md)
- [vvnint(_:_:_:)](accelerate/vvnint(_:_:_:).md)
- [vvnintf(_:_:_:)](accelerate/vvnintf(_:_:_:).md)
- [vvrsqrt(_:_:_:)](accelerate/vvrsqrt(_:_:_:).md)
- [vvrsqrtf(_:_:_:)](accelerate/vvrsqrtf(_:_:_:).md)
- [vvsqrt(_:_:_:)](accelerate/vvsqrt(_:_:_:).md)
- [vvsqrtf(_:_:_:)](accelerate/vvsqrtf(_:_:_:).md)
- [vvrec(_:_:_:)](accelerate/vvrec(_:_:_:).md)
- [vvrecf(_:_:_:)](accelerate/vvrecf(_:_:_:).md)
- [vvnextafter(_:_:_:_:)](accelerate/vvnextafter(_:_:_:_:).md)
- [vvnextafterf(_:_:_:_:)](accelerate/vvnextafterf(_:_:_:_:).md)

### Array-Oriented Exponential and Logarithmic Functions

- [exp(_:)](accelerate/vforce/exp(_:)-76nrd.md)
- [exp(_:)](accelerate/vforce/exp(_:)-5iaun.md)
- [exp(_:result:)](accelerate/vforce/exp(_:result:)-34nxw.md)
- [exp(_:result:)](accelerate/vforce/exp(_:result:)-4k85n.md)
- [exp2(_:)](accelerate/vforce/exp2(_:)-2m5q.md)
- [exp2(_:)](accelerate/vforce/exp2(_:)-4mm9y.md)
- [exp2(_:result:)](accelerate/vforce/exp2(_:result:)-6ru6m.md)
- [exp2(_:result:)](accelerate/vforce/exp2(_:result:)-8m564.md)
- [expm1(_:)](accelerate/vforce/expm1(_:)-xkzx.md)
- [expm1(_:)](accelerate/vforce/expm1(_:)-mfq5.md)
- [expm1(_:result:)](accelerate/vforce/expm1(_:result:)-4dpl4.md)
- [expm1(_:result:)](accelerate/vforce/expm1(_:result:)-2yhs3.md)
- [log10(_:)](accelerate/vforce/log10(_:)-9wr68.md)
- [log(_:)](accelerate/vforce/log(_:)-2gh9a.md)
- [log(_:)](accelerate/vforce/log(_:)-5ffby.md)
- [log(_:result:)](accelerate/vforce/log(_:result:)-84hv7.md)
- [log(_:result:)](accelerate/vforce/log(_:result:)-4k52e.md)
- [log1p(_:)](accelerate/vforce/log1p(_:)-5admq.md)
- [log1p(_:)](accelerate/vforce/log1p(_:)-3wn9e.md)
- [log1p(_:result:)](accelerate/vforce/log1p(_:result:)-8kk0n.md)
- [log1p(_:result:)](accelerate/vforce/log1p(_:result:)-5ckl.md)
- [log10(_:)](accelerate/vforce/log10(_:)-81jwh.md)
- [log10(_:result:)](accelerate/vforce/log10(_:result:)-3j9cp.md)
- [log10(_:result:)](accelerate/vforce/log10(_:result:)-35727.md)
- [log2(_:)](accelerate/vforce/log2(_:)-2gkui.md)
- [log2(_:)](accelerate/vforce/log2(_:)-9b3yo.md)
- [log2(_:result:)](accelerate/vforce/log2(_:result:)-5xk1k.md)
- [log2(_:result:)](accelerate/vforce/log2(_:result:)-2i9yi.md)
- [logb(_:)](accelerate/vforce/logb(_:)-6irl7.md)
- [logb(_:)](accelerate/vforce/logb(_:)-6hwhw.md)
- [logb(_:result:)](accelerate/vforce/logb(_:result:)-14tuo.md)
- [logb(_:result:)](accelerate/vforce/logb(_:result:)-1m3o3.md)
- [vvexp(_:_:_:)](accelerate/vvexp(_:_:_:).md)
- [vvexpf(_:_:_:)](accelerate/vvexpf(_:_:_:).md)
- [vvexp2(_:_:_:)](accelerate/vvexp2(_:_:_:).md)
- [vvexp2f(_:_:_:)](accelerate/vvexp2f(_:_:_:).md)
- [vvexpm1(_:_:_:)](accelerate/vvexpm1(_:_:_:).md)
- [vvexpm1f(_:_:_:)](accelerate/vvexpm1f(_:_:_:).md)
- [vvlog(_:_:_:)](accelerate/vvlog(_:_:_:).md)
- [vvlogf(_:_:_:)](accelerate/vvlogf(_:_:_:).md)
- [vvlog1p(_:_:_:)](accelerate/vvlog1p(_:_:_:).md)
- [vvlog1pf(_:_:_:)](accelerate/vvlog1pf(_:_:_:).md)
- [vvlog2(_:_:_:)](accelerate/vvlog2(_:_:_:).md)
- [vvlog2f(_:_:_:)](accelerate/vvlog2f(_:_:_:).md)
- [vvlog10(_:_:_:)](accelerate/vvlog10(_:_:_:).md)
- [vvlog10f(_:_:_:)](accelerate/vvlog10f(_:_:_:).md)
- [vvlogb(_:_:_:)](accelerate/vvlogb(_:_:_:).md)
- [vvlogbf(_:_:_:)](accelerate/vvlogbf(_:_:_:).md)

### Array-Oriented Power Functions

- [pow(bases:exponents:)](accelerate/vforce/pow(bases:exponents:)-94dha.md)
- [pow(bases:exponents:)](accelerate/vforce/pow(bases:exponents:)-3gl7v.md)
- [pow(bases:exponents:result:)](accelerate/vforce/pow(bases:exponents:result:)-4bso.md)
- [pow(bases:exponents:result:)](accelerate/vforce/pow(bases:exponents:result:)-6pffz.md)
- [vvpow(_:_:_:_:)](accelerate/vvpow(_:_:_:_:).md)
- [vvpowf(_:_:_:_:)](accelerate/vvpowf(_:_:_:_:).md)

### Array-Oriented Trigonometric Functions

- [acos(_:)](accelerate/vforce/acos(_:)-8srk.md)
- [acos(_:)](accelerate/vforce/acos(_:)-3hl5t.md)
- [acos(_:result:)](accelerate/vforce/acos(_:result:)-3c9qz.md)
- [acos(_:result:)](accelerate/vforce/acos(_:result:)-6rc2f.md)
- [asin(_:)](accelerate/vforce/asin(_:)-454ds.md)
- [asin(_:)](accelerate/vforce/asin(_:)-8vvt1.md)
- [asin(_:result:)](accelerate/vforce/asin(_:result:)-94jmy.md)
- [asin(_:result:)](accelerate/vforce/asin(_:result:)-ooti.md)
- [atan(_:)](accelerate/vforce/atan(_:)-1ghr3.md)
- [atan(_:)](accelerate/vforce/atan(_:)-5ejvk.md)
- [atan(_:result:)](accelerate/vforce/atan(_:result:)-691jp.md)
- [atan(_:result:)](accelerate/vforce/atan(_:result:)-6bb8n.md)
- [atan2(x:y:)](accelerate/vforce/atan2(x:y:)-h54u.md)
- [atan2(x:y:)](accelerate/vforce/atan2(x:y:)-3lku3.md)
- [atan2(x:y:result:)](accelerate/vforce/atan2(x:y:result:)-184b6.md)
- [atan2(x:y:result:)](accelerate/vforce/atan2(x:y:result:)-6j6xb.md)
- [cos(_:)](accelerate/vforce/cos(_:)-5eeyc.md)
- [cos(_:)](accelerate/vforce/cos(_:)-3q2fu.md)
- [cos(_:result:)](accelerate/vforce/cos(_:result:)-95syy.md)
- [cos(_:result:)](accelerate/vforce/cos(_:result:)-lrow.md)
- [cosPi(_:)](accelerate/vforce/cospi(_:)-8ouii.md)
- [cosPi(_:)](accelerate/vforce/cospi(_:)-578sc.md)
- [cosPi(_:result:)](accelerate/vforce/cospi(_:result:)-4rha2.md)
- [cosPi(_:result:)](accelerate/vforce/cospi(_:result:)-5ubws.md)
- [sin(_:)](accelerate/vforce/sin(_:)-61sn.md)
- [sin(_:)](accelerate/vforce/sin(_:)-6o1ao.md)
- [sin(_:result:)](accelerate/vforce/sin(_:result:)-6xo5w.md)
- [sin(_:result:)](accelerate/vforce/sin(_:result:)-oida.md)
- [sinPi(_:)](accelerate/vforce/sinpi(_:)-1wh5u.md)
- [sinPi(_:)](accelerate/vforce/sinpi(_:)-3a7fm.md)
- [sinPi(_:result:)](accelerate/vforce/sinpi(_:result:)-88a6o.md)
- [sinPi(_:result:)](accelerate/vforce/sinpi(_:result:)-9p5xq.md)
- [sincos(_:sinResult:cosResult:)](accelerate/vforce/sincos(_:sinresult:cosresult:)-93te.md)
- [sincos(_:sinResult:cosResult:)](accelerate/vforce/sincos(_:sinresult:cosresult:)-tk1q.md)
- [tan(_:)](accelerate/vforce/tan(_:)-6n5qw.md)
- [tan(_:)](accelerate/vforce/tan(_:)-3i3c1.md)
- [tan(_:result:)](accelerate/vforce/tan(_:result:)-8bosl.md)
- [tan(_:result:)](accelerate/vforce/tan(_:result:)-4wevz.md)
- [tanPi(_:)](accelerate/vforce/tanpi(_:)-9lrix.md)
- [tanPi(_:)](accelerate/vforce/tanpi(_:)-4z418.md)
- [tanPi(_:result:)](accelerate/vforce/tanpi(_:result:)-9d72p.md)
- [tanPi(_:result:)](accelerate/vforce/tanpi(_:result:)-1gp8g.md)
- [vvsin(_:_:_:)](accelerate/vvsin(_:_:_:).md)
- [vvsinf(_:_:_:)](accelerate/vvsinf(_:_:_:).md)
- [vvsinpi(_:_:_:)](accelerate/vvsinpi(_:_:_:).md)
- [vvsinpif(_:_:_:)](accelerate/vvsinpif(_:_:_:).md)
- [vvcos(_:_:_:)](accelerate/vvcos(_:_:_:).md)
- [vvcosf(_:_:_:)](accelerate/vvcosf(_:_:_:).md)
- [vvcospi(_:_:_:)](accelerate/vvcospi(_:_:_:).md)
- [vvcospif(_:_:_:)](accelerate/vvcospif(_:_:_:).md)
- [vvcosisin(_:_:_:)](accelerate/vvcosisin(_:_:_:).md)
- [vvcosisinf(_:_:_:)](accelerate/vvcosisinf(_:_:_:).md)
- [vvsincos(_:_:_:_:)](accelerate/vvsincos(_:_:_:_:).md)
- [vvsincosf(_:_:_:_:)](accelerate/vvsincosf(_:_:_:_:).md)
- [vvtan(_:_:_:)](accelerate/vvtan(_:_:_:).md)
- [vvtanf(_:_:_:)](accelerate/vvtanf(_:_:_:).md)
- [vvtanpi(_:_:_:)](accelerate/vvtanpi(_:_:_:).md)
- [vvtanpif(_:_:_:)](accelerate/vvtanpif(_:_:_:).md)
- [vvasin(_:_:_:)](accelerate/vvasin(_:_:_:).md)
- [vvasinf(_:_:_:)](accelerate/vvasinf(_:_:_:).md)
- [vvacos(_:_:_:)](accelerate/vvacos(_:_:_:).md)
- [vvacosf(_:_:_:)](accelerate/vvacosf(_:_:_:).md)
- [vvatan(_:_:_:)](accelerate/vvatan(_:_:_:).md)
- [vvatanf(_:_:_:)](accelerate/vvatanf(_:_:_:).md)
- [vvatan2(_:_:_:_:)](accelerate/vvatan2(_:_:_:_:).md)
- [vvatan2f(_:_:_:_:)](accelerate/vvatan2f(_:_:_:_:).md)

### Array-Oriented Hyperbolic Functions

- [acosh(_:)](accelerate/vforce/acosh(_:)-1j3qt.md)
- [acosh(_:)](accelerate/vforce/acosh(_:)-8zjay.md)
- [acosh(_:result:)](accelerate/vforce/acosh(_:result:)-4cip0.md)
- [acosh(_:result:)](accelerate/vforce/acosh(_:result:)-2r23w.md)
- [asinh(_:)](accelerate/vforce/asinh(_:)-ue6b.md)
- [asinh(_:)](accelerate/vforce/asinh(_:)-284n7.md)
- [asinh(_:result:)](accelerate/vforce/asinh(_:result:)-7wn57.md)
- [asinh(_:result:)](accelerate/vforce/asinh(_:result:)-17vv4.md)
- [atanh(_:)](accelerate/vforce/atanh(_:)-922d.md)
- [atanh(_:)](accelerate/vforce/atanh(_:)-2t372.md)
- [atanh(_:result:)](accelerate/vforce/atanh(_:result:)-6waj3.md)
- [atanh(_:result:)](accelerate/vforce/atanh(_:result:)-596wg.md)
- [cosh(_:)](accelerate/vforce/cosh(_:)-4dmhm.md)
- [cosh(_:)](accelerate/vforce/cosh(_:)-5ax3f.md)
- [cosh(_:result:)](accelerate/vforce/cosh(_:result:)-4f7in.md)
- [cosh(_:result:)](accelerate/vforce/cosh(_:result:)-3x3wu.md)
- [sinh(_:)](accelerate/vforce/sinh(_:)-54hpe.md)
- [sinh(_:)](accelerate/vforce/sinh(_:)-fwj2.md)
- [sinh(_:result:)](accelerate/vforce/sinh(_:result:)-6xge8.md)
- [sinh(_:result:)](accelerate/vforce/sinh(_:result:)-1ag0e.md)
- [tanh(_:)](accelerate/vforce/tanh(_:)-89qjn.md)
- [tanh(_:)](accelerate/vforce/tanh(_:)-4h4en.md)
- [tanh(_:result:)](accelerate/vforce/tanh(_:result:)-3fuc9.md)
- [tanh(_:result:)](accelerate/vforce/tanh(_:result:)-1fzsa.md)
- [vvsinh(_:_:_:)](accelerate/vvsinh(_:_:_:).md)
- [vvsinhf(_:_:_:)](accelerate/vvsinhf(_:_:_:).md)
- [vvcosh(_:_:_:)](accelerate/vvcosh(_:_:_:).md)
- [vvcoshf(_:_:_:)](accelerate/vvcoshf(_:_:_:).md)
- [vvtanh(_:_:_:)](accelerate/vvtanh(_:_:_:).md)
- [vvtanhf(_:_:_:)](accelerate/vvtanhf(_:_:_:).md)
- [vvasinh(_:_:_:)](accelerate/vvasinh(_:_:_:).md)
- [vvasinhf(_:_:_:)](accelerate/vvasinhf(_:_:_:).md)
- [vvacosh(_:_:_:)](accelerate/vvacosh(_:_:_:).md)
- [vvacoshf(_:_:_:)](accelerate/vvacoshf(_:_:_:).md)
- [vvatanh(_:_:_:)](accelerate/vvatanh(_:_:_:).md)
- [vvatanhf(_:_:_:)](accelerate/vvatanhf(_:_:_:).md)

### Data Types

- [COMPLEX](accelerate/complex.md)
- [DOUBLE_COMPLEX](accelerate/double_complex.md)

## See Also

### Vectors, Matrices, and Quaternions

- [Working with Vectors](accelerate/working-with-vectors.md)
- [Working with Matrices](accelerate/working-with-matrices.md)
- [Working with Quaternions](accelerate/working-with-quaternions.md)
- [Rotating a cube by transforming its vertices](accelerate/rotating-a-cube-by-transforming-its-vertices.md)
- [simd](accelerate/simd-library.md)
