POW(3Cg)

NAME
pow - returns x to the y-th power of scalars and vectors

SYNOPSIS
  float  pow(float  x, float  y);
  float1 pow(float1 x, float1 y);
  float2 pow(float2 x, float2 y);
  float3 pow(float3 x, float3 y);
  float4 pow(float4 x, float4 y);

  half   pow(half  x, half  y);
  half1  pow(half1 x, half1 y);
  half2  pow(half2 x, half2 y);
  half3  pow(half3 x, half3 y);
  half4  pow(half4 x, half4 y);

  fixed  pow(fixed  x, fixed  y);
  fixed1 pow(fixed1 x, fixed1 y);
  fixed2 pow(fixed2 x, fixed2 y);
  fixed3 pow(fixed3 x, fixed3 y);
  fixed4 pow(fixed4 x, fixed4 y);

PARAMETERS

x   A base value.

y   The power to raise the base.

DESCRIPTION
Returns x to the power y.

For vectors, the returned vector contains the power of each element of the base vector raised to the respective element of the exponent vector.

REFERENCE IMPLEMENTATION
pow for float3 vectors could be implemented this way:

  float3 pow(float3 x, float3 y)
  {
    float3 rv;

    for (int i=0; i<3; i++) {
      rv[i] = exp(x[i] * log(y[i]));
    }
    return rv;
  }

PROFILE SUPPORT
exp is supported in all profiles.

Support in the fp20 is limited to constant compile-time evaluation.

SEE ALSO
exp, lit, log, rsqrt, sqrt