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
|