Function

vvcopysign

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

Declaration

void vvcopysign(double *, const double *, const double *, const int *);

Parameters

parameter 1

The output array, z.

parameter 2

The magnitude input array, y.

parameter 3

The sign input array, x.

parameter 4

The number of elements in the arrays.

Discussion

The following code shows an example of using vvcopysign.

double x[] = {-1, -1, 1, 1};
double y[] = {1.2, 5.5, -16, 26.0};
double z[4];
int n = 4;
 
vvcopysign(z, y, x, &n);
 
NSLog(@"z: [%lf, %lf, %lf, %lf]", z[0], z[1], z[2], z[3]);

See Also

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.

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.