Floor Function Definition
Description b floor a rounds the elements of a to the nearest integers less than or equal to a.
Floor function definition. The floor function is a type of step function where the function is constant between any two integers. For complex a the imaginary and real parts are rounded independently. The result is the integer part of the calculated value in the same data type as numeric expression.
In mathematics and computer science the floor function is the function that takes as input a real number x displaystyle x and gives as output the greatest integer less than or equal to x displaystyle x denoted floor x displaystyle operatorname floor x or x displaystyle lfloor x rfloor. The floor function also called the greatest integer function or integer value spanier and oldham 1987 gives the largest integer less than or equal to. Header tgmath h provides a type generic macro version of this function.
Iverson graham et al. The following example shows positive numeric negative numeric and currency values with the floor function. A price floor is the lowest amount at which a good or service may be sold and still function within the traditional supply and demand model.
Additional overloads are provided in this header cmath for the integral types. Essentially they are the reverse of each other. Floor x rounds the number x down examples.
The least integer that is greater than or equal to x. Floor 1 6 equals 1 floor 1 2 equals 2 calculator. Lfloor x rfloor x is the floor function or the greatest integer function.
The floor function is similar to the ceiling function which rounds up. These overloads effectively cast x to a double before calculations defined for t being any integral type. The table below shows values for the function from 5 to 5 along with the corresponding graph.