Type Alias

simd_float4

A vector of four 32-bit single-precision values.

Declaration

typedef float __attribute__((ext_vector_type(4))) simd_float4;

Topics

Vector Creation Functions

simd_make_float4

Returns a new vector by truncating the specified vector.

simd_make_float4

Returns a new vector by truncating the specified vector.

simd_make_float4

Returns a new vector with the first element set to a scalar value, and other elements set to zero.

simd_make_float4

Returns a new vector with the first and second elements from a two-element vector, and other elements set to zero.

simd_make_float4

Returns a new vector with the first, second, and third elements from a three-element vector, and other elements set to zero.

simd_make_float4

Returns a new vector from a four-element vector.

simd_make_float4

Returns a new vector from 4 scalar values.

simd_make_float4

Returns a new vector from 2 scalar values and a two-element vector.

simd_make_float4

Returns a new vector from 2 scalar values and a two-element vector.

simd_make_float4

Returns a new vector from 2 scalar values and a two-element vector.

simd_make_float4

Returns a new vector from 2 two-element vectors.

simd_make_float4

Returns a new vector from a scalar value and a three-element vector.

simd_make_float4

Returns a new vector from a scalar value and a three-element vector.

simd_make_float4_undef

Returns a new vector with the first element set to a scalar value, and other elements undefined.

simd_make_float4_undef

Returns a new vector with the first and second elements from a two-element vector, and other elements undefined.

simd_make_float4_undef

Returns a new vector with the first, second, and third elements from a three-element vector, and other elements undefined.

Common Functions

simd_abs

Returns the absolute value of each element in a vector.

simd_clamp

Returns each element in a vector clamped to a specified range.

simd_sign

Returns the sign of each element in a vector.

simd_fract

Returns the fractional part of each element in a vector.

simd_step

Returns zero for each element in a vector less than a specified edge; one otherwise.

simd_equal

Returns true if all elements of a vector are equal; false otherwise.

Reduce Functions

simd_reduce_add

Returns the sum of all elements in a vector.

simd_reduce_max

Returns the maximum value in a vector.

simd_reduce_min

Returns the minimum value in a vector.

Interpolation Functions

simd_mix

Returns an elementwise linearly interpolated value between two vectors.

simd_smoothstep

Returns an elementwise smoothly interpolated value between two vectors.

Extrema Functions

simd_max

Returns the maximum value of each element in a vector.

simd_min

Returns the minimum value of each element in a vector.

Reciprocal and Reciprocal Square Root Functions

simd_recip

Returns the reciprocal of each element in a vector.

simd_rsqrt

Returns the reciprocal square root of each element in a vector.

simd_precise_recip

Returns the precise reciprocal of each element in a vector.

simd_precise_rsqrt

Returns the precise reciprocal square root of each element in a vector.

simd_fast_recip

Returns the fast reciprocal of each element in a vector.

simd_fast_rsqrt

Returns the fast reciprocal square root of each element in a vector.

Exponential and Logarithmic Functions

exp

Returns e raised to the power of each element in a vector.

exp2

Returns 2 raised to the power of each element in a vector.

exp10

Returns 10 raised to the power of each element in a vector.

expm1

Returns eˣ-1 for each element in a vector.

log

Returns the natural logarithm of each element in a vector.

log2

Returns the base 2 logarithm of each element in a vector.

log10

Returns the base 10 logarithm of each element in a vector.

log1p

Returns log(1+x) for each element in a vector.

Geometry Functions

simd_dot

Returns the dot product of two vectors.

simd_normalize

Returns a vector pointing in the same direction of the supplied vector with a length of 1.

simd_project

Returns the first vector projected onto the second vector.

simd_precise_normalize

Returns the precise normalized vector.

simd_precise_project

Returns the precise projected vector.

simd_fast_normalize

Returns the fast normalized vector.

simd_fast_project

Returns the fast projected vector.

simd_distance_squared

Returns the square of the distance between two vectors.

simd_length

Returns the length of a vector.

simd_length_squared

Returns the square of the length of a vector.

simd_norm_inf

Returns the inf-norm (the maximum absolute value) of a vector.

simd_norm_one

Returns the one-norm (the sum of absolute values) of a vector.

simd_refract

Returns the refraction direction of an incident vector, a unit normal vector, and an index of refraction eta.

simd_reflect

Returns the reflection direction of an incident vector and a unit normal vector.

Hyperbolic Functions

acosh

Returns the inverse hyperbolic cosine of each element in a vector.

asinh

Returns the inverse hyperbolic sine of each element in a vector.

atanh

Returns the inverse hyperbolic tangent of each element in a vector.

cosh

Returns the hyperbolic cosine of each element in a vector.

sinh

Returns the hyperbolic sine of each element in a vector.

tanh

Returns the hyperbolic tangent of each element in a vector.

Logic Functions

simd_select

Returns a vector containing elements from either the first or second parameter, depending on the high-order bit of the corresponding element in the third parameter.

simd_bitselect

Returns a vector containing elements from either the first or second parameter, depending on the corresponding element in the third parameter.

Math Functions

cbrt

Returns the cube root of each element in a vector.

copysign

Returns each element of a vector, with the sign of the corresponding element in a second vector.

erf

Returns the error function for each element in a vector.

erfc

Returns the complementary error function for each element in a vector.

fabs

Returns the absolute value of each element in a vector.

fdim

Returns the positive difference between corresponding elements in two vectors.

fma

Returns the multiply-add result for corresponding elements in three vectors.

fmod

Returns the modulus after dividing each element in a vector by the corresponding element in a second vector.

hypot

Returns the hypotenuse of a right-angled triangle with the sides that are adjacent to the right angle defined by two vectors.

nextafter

Returns the next representable value of each element in a vector in the direction of the corresponding element in a second vector.

pow

Returns each element in a vector raised to the power of the corresponding element in a second vector.

remainder

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

rint

Returns each element in a vector rounded to the nearest integer in the specified direction.

round

Returns each element in a vector rounded to the nearest integer.

simd_muladd

Returns the multiply-add result for corresponding elements in three vectors.

sqrt

Returns the square root of each element in a vector.

tgamma

Returns the gamma function for each element in a vector.

Trigonometric Functions

acos

Returns the arccosine of each element in a vector.

asin

Returns the arcsine of each element in a vector.

atan

Returns the arctangent of each element in a vector.

atan2

Returns the arctangent of each pair of corresponding elements in two vectors.

cos

Returns the cosine of each element in a vector.

cospi

Returns the cosine of each element in a vector multiplied by pi.

sin

Returns the sine of each element in a vector.

sinpi

Returns the sine of each element in a vector multiplied by pi.

tan

Returns the tangent of each element in a vector.

tanpi

Returns the tangent of each element in a vector multiplied by pi.

See Also

Vectors: Single-Precision Values

simd_float2

A vector of two 32-bit single-precision values.

simd_float3

A vector of three 32-bit single-precision values.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software