# vForce

Perform transcendental and trigonometric functions on vectors of any length.

## Overview

The `vForce.h` header file declares a set of trigonometric and transcendental functions in terms of C arrays (`double *` or `float *`), which can be of any length. Internally, the functions are vectorized for the current architecture.

The functions declared in `vForce.h` have the customary mathematical names, but with the prefix "vv." Each mathematical function is available in two variants: one for single-precision floating-point data and one for double-precision data. The single-precision forms have the suffix "f," while the double-precision forms have no suffix. For example, `vvcosf` is the single-precision cosine function, while `vvcos` is the double-precision variant.

All of the vForce.h 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 which 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.

### Using vForce

vForce 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`, that contains the square root of each array element.

The equivalent functionality implemented in vForce runs significantly faster:

## Topics

### Array-Oriented Arithmetic and Auxiliary Functions

`vvceil`

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

`vvceilf`

Calculates the ceiling of each element in an array of single-precision values.

`vvfloor`

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

`vvfloorf`

Calculates the floor of each element in an array of single-precision values.

`vvcopysign`

Copies an array, setting the sign of each element based on a second array of double-precision values.

`vvcopysignf`

Copies an array, setting the sign of each element based on a second array of single-precision values.

`vvdiv`

Divides each element in an array by the corresponding value in a second array of double-precision values.

`vvdivf`

Divides each element in an array by the corresponding value in a second array of single-precision values.

`vvfabs`

Calculates the absolute value for each element in an array of double-precision values.

`vvfabsf`

Calculates the absolute value for each element in an array of single-precision values.

`vvfmod`

Calculates the modulus after dividing each element in an array by the corresponding element in a second array of double-precision values.

`vvfmodf`

Calculates the modulus after dividing each element in an array by the corresponding element in a second array of single-precision values.

`vvremainder`

Calculates the remainder after dividing each element in an array by the corresponding element in a second array of double-precision values.

`vvremainderf`

Calculates the remainder after dividing each element in an array by the corresponding element in a second array of single-precision values.

`vvint`

Calculates the integer truncation for each element in an array of double-precision values.

`vvintf`

Calculates the integer truncation for each element in an array of single-precision values.

`vvnint`

Calculates the nearest integer for each element in an array of double-precision values.

`vvnintf`

Calculates the nearest integer for each element in an array of single-precision values.

`vvrsqrt`

Calculates the reciprocal square root of each element in an array of double-precision values.

`vvrsqrtf`

Calculates the reciprocal square root of each element in an array of single-precision values.

`vvsqrt`

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

`vvsqrtf`

Calculates the square root of each element in an array of single-precision values.

`vvrec`

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

`vvrecf`

Calculates the reciprocal of each element in an array of single-precision values.

`vvnextafter`

Calculates the next machine-representable value for each element in an array of double-precision values.

`vvnextafterf`

Calculates the next machine-representable value for each element in an array of single-precision values.

### Array-Oriented Exponential and Logarithmic Functions

`vvexp`

Calculates e raised to the power of each element in an array of double-precision values.

`vvexpf`

Calculates e raised to the power of each element in an array of single-precision values.

`vvexp2`

Calculates 2 raised to the power of each element in an array of double-precision values.

`vvexp2f`

Calculates 2 raised to the power of each element in an array of single-precision values.

`vvexpm1`

Calculates eˣ-1 for each element in an array of double-precision values.

`vvexpm1f`

Calculates eˣ-1 for each element in an array of single-precision values.

`vvlog`

Calculates the natural logarithm for each element in an array of double-precision values.

`vvlogf`

Calculates the natural logarithm for each element in an array of single-precision values.

`vvlog1p`

Calculates log(1+x) for each element in an array of double-precision values.

`vvlog1pf`

Calculates log(1+x) for each element in an array of single-precision values.

`vvlog2`

Calculates the base 2 logarithm of each element in an array of double-precision values.

`vvlog2f`

Calculates the base 2 logarithm of each element in an array of single-precision values.

`vvlog10`

Calculates the base 10 logarithm of each element in an array of double-precision values.

`vvlog10f`

Calculates the base 10 logarithm of each element in an array of single-precision values.

`vvlogb`

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

`vvlogbf`

Calculates the unbiased exponent of each element in an array of single-precision values.

### Array-Oriented Power Functions

`vvpow`

Raises each element in an array to the power of the corresponding element in a second array of double-precision values.

`vvpowf`

Raises each element in an array to the power of the corresponding element in a second array of single-precision values.

### Array-Oriented Trigonometric Functions

`vvsin`

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

`vvsinf`

Calculates the sine of each element in an array of single-precision values.

`vvsinpi`

Calculates the sine of pi multiplied by each element in an array of double-precision values.

`vvsinpif`

Calculates the sine of pi multiplied by each element in an array of single-precision values.

`vvcos`

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

`vvcosf`

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

`vvcospi`

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

`vvcospif`

Calculates the cosine of pi multiplied by each element in an array of single-precision values.

`vvcosisin`

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

`vvcosisinf`

Calculates the cosine and sine of each element in an array of single-precision values.

`vvsincos`

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

`vvsincosf`

Calculates the cosine and sine of each element in an array of single-precision values.

`vvtan`

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

`vvtanf`

Calculates the tangent of each element in an array of single-precision values.

`vvtanpi`

Calculates the tangent of pi multiplied by each element in an array of double-precision values.

`vvtanpif`

Calculates the tangent of pi multiplied by each element in an array of single-precision values.

`vvasin`

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

`vvasinf`

Calculates the arcsine of each element in an array of single-precision values.

`vvacos`

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

`vvacosf`

Calculates the arccosine of each element in an array of single-precision values.

`vvatan`

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

`vvatanf`

Calculates the arctangent of each element in an array of single-precision values.

`vvatan2`

Calculates the arctangent of each pair of elements in two arrays of double-precision values.

`vvatan2f`

Calculates the arctangent of each pair of elements in two arrays of single-precision values.

### Array-Oriented Hyperbolic Functions

`vvsinh`

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

`vvsinhf`

Calculates the hyperbolic sine of each element in an array of single-precision values.

`vvcosh`

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

`vvcoshf`

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

`vvtanh`

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

`vvtanhf`

Calculates the hyperbolic tangent of each element in an array of single-precision values.

`vvasinh`

Calculates the inverse hyperbolic sine of each element in an array of double-precision values.

`vvasinhf`

Calculates the inverse hyperbolic sine of each element in an array of single-precision values.

`vvacosh`

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

`vvacoshf`

Calculates the inverse hyperbolic cosine of each element in an array of single-precision values.

`vvatanh`

Calculates the inverse hyperbolic tangent of each element in an array of double-precision values.

`vvatanhf`

Calculates the inverse hyperbolic tangent of each element in an array of single-precision values.

### Data Types

`__float_complex_t`

A single-precision complex number type.

`__double_complex_t`

A double-precision complex number type.