vec_cpsgn

Purpose

Returns a vector by copying the sign of the elements in vector a to the sign of the corresponding elements in vector b.

Syntax

d=vec_cpsgn(a, b)

Result and argument types

The following table describes the types of the returned value and the function arguments.

d a b
vector4double vector4double vector4double

Result value

The values of the elements of the result are obtained by copying the sign of the elements in a to the sign of the corresponding elements in b.

Formula

d[0] = (double) { sign(a[0]), mantissa(b[0]), exponent(b[0]) }
d[1] = (double) { sign(a[1]), mantissa(b[1]), exponent(b[1]) }
d[2] = (double) { sign(a[2]), mantissa(b[2]), exponent(b[2]) }
d[3] = (double) { sign(a[3]), mantissa(b[3]), exponent(b[3]) }

Example

a =  (   -1.0,    2.0,    -3.0,    4.0)
b =  ( 1.5e10, 2.5e15,  3.5e20, 4.5e25)
d: (-1.5e10, 2.5e15, -3.5e20, 4.5e25)