Name

floor - returns largest integer not greater than a scalar or each vector component.

Synopsis

float  floor(float a);
float1 floor(float1 a);
float2 floor(float2 a);
float3 floor(float3 a);
float4 floor(float4 a);

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

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

Parameters

a
Vector or scalar of which to determine the floor.

Description

Returns the floor or largest integer not greater than a scalar or each vector component.

Reference Implementation

floor for a float3 vector could be implemented like this.

float3 floor(float3 v)
{
  float3 rv;
  int i;

  for (i=0; i<3; i++) {
    rv[i] = v[i] - frac(v[i]);
  }
  return rv;
}

Profile Support

floor is supported in all profiles except fp20.

See Also

ceil, round