LOG2(3Cg)

NAME
log2 - returns the base-2 logarithm of scalars and vectors

SYNOPSIS
  float  log2(float a);
  float1 log2(float1 a);
  float2 log2(float2 a);
  float3 log2(float3 a);
  float4 log2(float4 a);

  half   log2(half a);
  half1  log2(half1 a);
  half2  log2(half2 a);
  half3  log2(half3 a);
  half4  log2(half4 a);

  fixed  log2(fixed a);
  fixed1 log2(fixed1 a);
  fixed2 log2(fixed2 a);
  fixed3 log2(fixed3 a);
  fixed4 log2(fixed4 a);

PARAMETERS

a   Vector or scalar of which to determine the base-2 logarithm.

DESCRIPTION
Returns the base-2 logarithm a.

For vectors, the returned vector contains the base-2 logarithm of each element of the input vector.

REFERENCE IMPLEMENTATION
  float3 log2(float3 a)
  {
    float3 rv;
    int i;

    for (i=0; i<3; i++) {
      rv[i] = log2(a[i]);  // this is the ANSI C standard library log2()
    }
    return rv;
  }

log2 is typically implemented with a native base-2 logarithm instruction.

PROFILE SUPPORT
log2 is fully supported in all profiles unless otherwise specified.

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

SEE ALSO
exp, log, log10, pow