Functions
rs_cl.rsh File Reference

Functions

float acos (float)
float acosh (float)
_RS_RUNTIME float acospi (float v)
float asin (float)
float asinh (float)
_RS_RUNTIME float asinpi (float v)
float atan (float)
float atan2 (float y, float x)
float atanh (float)
_RS_RUNTIME float atanpi (float v)
_RS_RUNTIME float atan2pi (float y, float x)
float cbrt (float)
float ceil (float)
float copysign (float x, float y)
float cos (float)
float cosh (float)
_RS_RUNTIME float cospi (float v)
float erfc (float)
float erf (float)
float exp (float)
float exp2 (float)
float pow (float x, float y)
_RS_RUNTIME float exp10 (float v)
float expm1 (float)
float fabs (float)
float fdim (float, float)
float floor (float)
float fma (float a, float b, float c)
float fmax (float x, float y)
float fmin (float x, float y)
float fmod (float x, float y)
_RS_RUNTIME float fract (float v, float *iptr)
float frexp (float v, int *iptr)
float hypot (float x, float y)
int ilogb (float)
float ldexp (float x, int y)
float lgamma (float)
float lgamma (float x, int *y)
float log (float)
float log10 (float)
_RS_RUNTIME float log2 (float v)
float log1p (float v)
float logb (float)
float mad (float a, float b, float c)
float modf (float x, float *iret)
float nextafter (float x, float y)
_RS_RUNTIME float pown (float v, int p)
_RS_RUNTIME float powr (float v, float p)
float remainder (float x, float y)
float rint (float)
_RS_RUNTIME float rootn (float v, int n)
float round (float)
float sqrt (float)
_RS_RUNTIME float rsqrt (float v)
float sin (float v)
_RS_RUNTIME float sincos (float v, float *cosptr)
float sinh (float)
_RS_RUNTIME float sinpi (float v)
float tan (float v)
float tanh (float)
_RS_RUNTIME float tanpi (float v)
float tgamma (float)
float trunc (float)
_RS_RUNTIME float clamp (float amount, float low, float high)
_RS_RUNTIME float degrees (float radians)
_RS_RUNTIME float mix (float start, float stop, float amount)
_RS_RUNTIME float radians (float degrees)
_RS_RUNTIME float step (float edge, float v)
_RS_RUNTIME float sign (float v)
_RS_RUNTIME float3 cross (float3 lhs, float3 rhs)
_RS_RUNTIME float dot (float lhs, float rhs)
_RS_RUNTIME float length (float v)
_RS_RUNTIME float distance (float lhs, float rhs)
_RS_RUNTIME float normalize (float v)

Detailed Description

Basic math functions.

Definition in file rs_cl.rsh.


Function Documentation

float acos ( float  )

Return the inverse cosine.

Supports float, float2, float3, float4

float acosh ( float  )

Return the inverse hyperbolic cosine.

Supports float, float2, float3, float4

_RS_RUNTIME float acospi ( float  v)

Return the inverse cosine divided by PI.

Supports float, float2, float3, float4

float asin ( float  )

Return the inverse sine.

Supports float, float2, float3, float4

float asinh ( float  )

Return the inverse hyperbolic sine.

Supports float, float2, float3, float4

_RS_RUNTIME float asinpi ( float  v)

Return the inverse sine divided by PI.

Supports float, float2, float3, float4

float atan ( float  )

Return the inverse tangent.

Supports float, float2, float3, float4

float atan2 ( float  y,
float  x 
)

Return the inverse tangent of y / x.

Supports float, float2, float3, float4. Both arguments must be of the same type.

Parameters:
y
x
_RS_RUNTIME float atan2pi ( float  y,
float  x 
)

Return the inverse tangent of y / x, divided by PI.

Supports float, float2, float3, float4. Both arguments must be of the same type.

Parameters:
y
x
float atanh ( float  )

Return the inverse hyperbolic tangent.

Supports float, float2, float3, float4

_RS_RUNTIME float atanpi ( float  v)

Return the inverse tangent divided by PI.

Supports float, float2, float3, float4

float cbrt ( float  )

Return the cube root.

Supports float, float2, float3, float4.

float ceil ( float  )

Return the smallest integer not less than a value.

Supports float, float2, float3, float4.

_RS_RUNTIME float4 clamp ( float  amount,
float  low,
float  high 
)

Return the minimum of two values.

Supports 1,2,3,4 components of uchar, char, ushort, short, uint, int, float. Return the maximum of two values.

Supports 1,2,3,4 components of uchar, char, ushort, short, uint, int, float. Clamp a value to a specified high and low bound.

Parameters:
amountvalue to be clamped. Supports 1,2,3,4 components
lowLower bound, must be scalar or matching vector.
highHigh bound, must match type of low
float copysign ( float  x,
float  y 
)

Copy the sign bit from y to x.

Supports float, float2, float3, float4. Both arguments must be of the same type.

Parameters:
x
y
float cos ( float  )

Return the cosine.

Supports float, float2, float3, float4.

float cosh ( float  )

Return the hypebolic cosine.

Supports float, float2, float3, float4.

_RS_RUNTIME float cospi ( float  v)

Return the cosine of the value * PI.

Supports float, float2, float3, float4.

_RS_RUNTIME float4 cross ( float3  lhs,
float3  rhs 
)

Compute the cross product of two vectors.

Supports 3,4 components

_RS_RUNTIME float degrees ( float  radians)

Convert from radians to degrees.

Supports 1,2,3,4 components

_RS_RUNTIME float distance ( float  lhs,
float  rhs 
)

Compute the distance between two points.

Supports 1,2,3,4 components

_RS_RUNTIME float dot ( float  lhs,
float  rhs 
)

Compute the dot product of two vectors.

Supports 1,2,3,4 components

float erf ( float  )

Return the error function.

Supports float, float2, float3, float4.

float erfc ( float  )

Return the complementary error function.

Supports float, float2, float3, float4.

float exp ( float  )

Return e ^ value.

Supports float, float2, float3, float4.

_RS_RUNTIME float exp10 ( float  v)

Return 10 ^ value.

Supports float, float2, float3, float4.

float exp2 ( float  )

Return 2 ^ value.

Supports float, float2, float3, float4.

float expm1 ( float  )

Return (e ^ value) - 1.

Supports float, float2, float3, float4.

float fabs ( float  )

Return the absolute value of a value.

Supports float, float2, float3, float4.

float fdim ( float  ,
float   
)

Return the positive difference between two values.

Supports float, float2, float3, float4. Both arguments must be of the same type.

float floor ( float  )

Return the smallest integer not greater than a value.

Supports float, float2, float3, float4.

float fma ( float  a,
float  b,
float  c 
)

Return a*b + c.

Supports float, float2, float3, float4.

float fmax ( float  x,
float  y 
)

Return (x < y ? y : x)

Supports float, float2, float3, float4.

Parameters:
x,:may be float, float2, float3, float4
y,:may be float or vector. If vector must match type of x.
float fmin ( float  x,
float  y 
)

Return (x > y ? y : x)

Parameters:
x,:may be float, float2, float3, float4
y,:may be float or vector. If vector must match type of x.
float fmod ( float  x,
float  y 
)

Return the remainder from x / y

Supports float, float2, float3, float4.

_RS_RUNTIME float fract ( float  v,
float *  iptr 
)

Return fractional part of v

Parameters:
iptriptr[0] will be set to the floor of the input value. Supports float, float2, float3, float4.
float frexp ( float  v,
int *  iptr 
)

Return the mantissa and place the exponent into iptr[0]

Parameters:
vSupports float, float2, float3, float4.
iptrMust have the same vector size as v.
float hypot ( float  x,
float  y 
)

Return sqrt(x*x + y*y)

Supports float, float2, float3, float4.

int ilogb ( float  )

Return the integer exponent of a value

Supports 1,2,3,4 components

float ldexp ( float  x,
int  y 
)

Return (x * 2^y)

Parameters:
xSupports 1,2,3,4 components
ySupports single component or matching vector.
_RS_RUNTIME float length ( float  v)

Compute the length of a vector.

Supports 1,2,3,4 components

float lgamma ( float  )

Return the log gamma

Supports 1,2,3,4 components

float lgamma ( float  x,
int *  y 
)

Return the log gamma and sign

Parameters:
xSupports 1,2,3,4 components
ySupports matching vector.
float log ( float  )

Return the natural logarithm

Supports 1,2,3,4 components

float log10 ( float  )

Return the base 10 logarithm

Supports 1,2,3,4 components

float log1p ( float  v)

Return the natural logarithm of (v + 1.0f)

Supports 1,2,3,4 components

_RS_RUNTIME float log2 ( float  v)

Return the base 2 logarithm

Supports 1,2,3,4 components

float logb ( float  )

Compute the exponent of the value.

Supports 1,2,3,4 components

float mad ( float  a,
float  b,
float  c 
)

Compute (a * b) + c

Supports 1,2,3,4 components

_RS_RUNTIME float4 mix ( float  start,
float  stop,
float  amount 
)

return start + ((stop - start) * amount);

Supports 1,2,3,4 components

float modf ( float  x,
float *  iret 
)

Return the integral and fractional components of a number Supports 1,2,3,4 components

Parameters:
xSource value
iretiret[0] will be set to the integral portion of the number.
Returns:
The floating point portion of the value.
float nextafter ( float  x,
float  y 
)

Return the next floating point number from x towards y.

Supports 1,2,3,4 components

_RS_RUNTIME float4 normalize ( float  v)

Normalize a vector.

Supports 1,2,3,4 components

float pow ( float  x,
float  y 
)

Return x ^ y.

Supports float, float2, float3, float4. Both arguments must be of the same type.

_RS_RUNTIME float pown ( float  v,
int  p 
)

Return (v ^ p).

Supports 1,2,3,4 components

_RS_RUNTIME float powr ( float  v,
float  p 
)

Return (v ^ p).

Parameters:
vmust be greater than 0.

Supports 1,2,3,4 components

_RS_RUNTIME float radians ( float  degrees)

Convert from degrees to radians.

Supports 1,2,3,4 components

float remainder ( float  x,
float  y 
)

Return round x/y to the nearest integer then compute the remander.

Supports 1,2,3,4 components

float rint ( float  )

Round to the nearest integral value.

Supports 1,2,3,4 components

_RS_RUNTIME float rootn ( float  v,
int  n 
)

Compute the Nth root of a value.

Supports 1,2,3,4 components

float round ( float  )

Round to the nearest integral value. Half values are rounded away from zero.

Supports 1,2,3,4 components

_RS_RUNTIME float rsqrt ( float  v)

Return (1 / sqrt(value)).

Parameters:
vThe incoming value in radians Supports 1,2,3,4 components
_RS_RUNTIME float sign ( float  v)

if (v < 0) return -1.f; else if (v > 0) return 1.f; else return 0.f;

Supports 1,2,3,4 components

float sin ( float  v)

Return the sine of a value specified in radians.

Parameters:
vThe incoming value in radians Supports 1,2,3,4 components
_RS_RUNTIME float sincos ( float  v,
float *  cosptr 
)

Return the sine and cosine of a value.

Returns:
sine
Parameters:
vThe incoming value in radians
*cosptrcosptr[0] will be set to the cosine value.

Supports 1,2,3,4 components

float sinh ( float  )

Return the hyperbolic sine of a value specified in radians.

Supports 1,2,3,4 components

_RS_RUNTIME float sinpi ( float  v)

Return the sin(v * PI).

Supports 1,2,3,4 components

float sqrt ( float  )

Return the square root of a value.

Supports 1,2,3,4 components

_RS_RUNTIME float4 step ( float  edge,
float  v 
)

if (v < edge) return 0.f; else return 1.f;

Supports 1,2,3,4 components

float tan ( float  v)

Return the tangent of a value.

Supports 1,2,3,4 components

Parameters:
vThe incoming value in radians
float tanh ( float  )

Return the hyperbolic tangent of a value.

Supports 1,2,3,4 components

Parameters:
vThe incoming value in radians
_RS_RUNTIME float tanpi ( float  v)

Return tan(v * PI)

Supports 1,2,3,4 components

float tgamma ( float  )

Compute the gamma function of a value.

Supports 1,2,3,4 components

float trunc ( float  )

Round to integral using truncation.

Supports 1,2,3,4 components