FRAC(3Cg)

NAME
frac - returns the fractional portion of a scalar or each vector component.

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

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

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

PARAMETERS

a   Vector or scalar of which to return its fractional portion.

DESCRIPTION
Returns the fractional portion of a scalar or each vector component.

REFERENCE IMPLEMENTATION
frac for a float scalar could be implemented like this.

  float frac(float v)
  {
    return v - floor(v);
  }

PROFILE SUPPORT
frac is supported in all profiles except fp20.

SEE ALSO
ceil, floor, round, trunc