Floor and Ceiling Functions

With the Floor Function, we throw away the fractional part. That part is called the frac or fractional part function:

Oh no! There are lots of integers less than 2.31.

Thegreatestinteger that isless than(or equal to) 2.31 is2

… and it has to beless than(or maybe equal to) 2.31, right?

A solid dot means including and an open dot means not including.

The Int function (short for integer) is like the Floor function, BUT some calculators and computer programs show different results when given negative numbers:

What if we want the floor or ceiling of a number that is already an integer?

The Floor Function is this curious step function (like an infinite staircase):

Floor Function: the greatest integer that is less than or equal tox

So be careful using this function with negative values.

Ceiling Function: the least integer that is greater than or equal tox

Choose thegreatestone (which is2in this case)

How do we give this a formal definition?

So: frac(3.65) = (3.65) floor(3.65) = (3.65) (4) = 3.65 + 4 =0.35

The symbols for floor and ceiling are like the square brackets[ ]with the top or bottom part missing:

BUTmany calculators and computer programs usefrac(x) = x int(x), and so their result depends on how they calculateint(x):

The floor and ceiling functions give us the

Here are some example values for you:

So: frac(3.65) = 3.65 floor(3.65) = 3.65 3 =0.65

But I prefer to use the word form:floor(x) andceil(x)

Floor and Ceiling Functions

Leave a Comment