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