vec_extract

Purpose

Returns the value of element a from the vector b.

Syntax

d=vec_extract(a, b)

Result and argument types

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

d a b
double vector4double int

Result value

This function uses the modulo arithmetic on b to determine the element number. For example, if b is out of range, the compiler uses b modulo the number of elements in the vector to determine the element position.

Formula

d = a[b MOD 4]
Note: MOD is the modulo operator.

Example

a = (10.0, 20.0, 30.0, 40.0)
b = 1
d: 20.0