Macro

rint

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

Declaration

#define rint(__x)

Discussion

Use the fesetround(_:) function to specify the rounding direction. For example:

simd_float4 x;
x = simd_make_float4(1.2, 1.4, 1.6, 1.8);

fesetround(FE_DOWNWARD);
simd_float4 resultDownward = rint(x); // (1, 1, 1, 1)

fesetround(FE_UPWARD);
simd_float4 resultUpward = rint(x); // (2, 2, 2, 2)
    
fesetround(FE_TONEAREST);
simd_float4 resultNearest = rint(x); // (1, 1, 2, 2)

See Also

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.

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.