Mathematics • September 24, 2026

Floor Function: Definition and Examples

Master the floor function definition. Learn exactly how the greatest integer function handles negative numbers, decimals, fractions, and programming algorithms.

If you evaluate the floor function on a simple decimal like 5.7, the answer feels entirely intuitive. ⌊5.7⌋ = 5

It looks exactly as if the mathematical operation just grabbed an eraser, deleted the decimal point, and left the base number untouched.

But what happens when you evaluate the floor function on a negative value? ⌊-5.7⌋ = -6

This second example constantly surprises beginners because the floor function does not simply mean “remove the decimal” or “round down toward zero.” If that were true, the answer would be -5. Instead, the number mysteriously grew in absolute magnitude to become -6. To calculate this correctly every time, you must stop thinking about the floor function as an eraser and start thinking about it as a rigid direction on a number line.

Floor Function: The Short Answer

Before we explore the underlying geometry, here is the direct mathematical answer.

The floor function gives the greatest integer that is strictly less than or equal to a given number. In standard mathematics, this is written using specialized bottom-heavy brackets.

Notation: ⌊x⌋

Examples:

  • ⌊5.7⌋ = 5
  • ⌊5⌋ = 5
  • ⌊-5.7⌋ = -6
  • ⌊0.8⌋ = 0
  • ⌊-0.8⌋ = -1

The absolute most important rule you can memorize is this: The floor function moves a number toward negative infinity to the greatest integer that is less than or equal to it.

Key takeaway: The floor function ⌊x⌋ is the greatest integer less than or equal to x. For positive numbers it often looks like ordinary rounding down, but for negative numbers it aggressively moves toward negative infinity.

What Is the Floor Function?

The floor function is an algorithmic filter. You pass a real number into it, and it outputs a clean integer based on very strict dimensional boundaries.

The phrase “greatest integer” simply refers to the absolute largest possible whole number available on the line. The phrase “less than or equal to” dictates the direction you are allowed to look. You can only look to the left.

The specialized brackets (with missing upper tabs) physically demonstrate this concept by visually trapping the number and pushing it downward onto the floor. The result is absolutely always an integer.

Simple examples:

  • ⌊4.2⌋ = 4
  • ⌊9.99⌋ = 9
  • ⌊12⌋ = 12
  • ⌊0.4⌋ = 0
  • ⌊-2.3⌋ = -3

Floor Function Notation

When reading academic textbooks or reading computer science documentation, you will encounter several different labels for the exact same underlying logic engine.

The standard notation is ⌊x⌋.

However, it may also be called:

  • Floor function
  • Greatest integer function
  • Greatest integer less than or equal to the number
  • Entier function (in older European texts)

You should be aware that different programming languages might label it slightly differently, though most modern systems standardized around the term “floor” decades ago.

Floor Function Examples

Review this table carefully to see how the engine reacts to shifting decimals.

NumberFloor
5.15
5.75
5.995
66
6.16
0.90
00
-0.2-1
-0.9-1
-1.2-2
-5.7-6

Floor Function for Positive Numbers

For positive numbers, the pattern feels incredibly natural because it perfectly aligns with our everyday intuition about size.

Examples:

  • ⌊2.1⌋ = 2
  • ⌊2.9⌋ = 2
  • ⌊7.4⌋ = 7
  • ⌊99.99⌋ = 99

In all of these cases, the algorithm simply identifies the whole number integer resting immediately below the decimal point. This behavior causes many students to falsely assume that the floor function is just a fancy mathematical term for “erase the decimal.” As we will prove below, this assumption becomes dangerous the second you cross the zero line.

Floor Function for Negative Numbers

This is one of the most critical sections for understanding computer science algorithms.

When a number is negative, the floor function must slide further to the left to find a mathematically smaller integer.

Examples:

  • ⌊-5.2⌋ = -6
  • ⌊-5.8⌋ = -6
  • ⌊-2.1⌋ = -3
  • ⌊-0.1⌋ = -1

Floor means moving toward negative infinity, not toward zero.

If we plot -5.7 on a number line, we can see exactly where it sits. -6 < -5.7 < -5

The integer -5 is mathematically greater than -5.7. Because the floor function strictly demands an integer that is “less than or equal to” the input, -5 is immediately disqualified. The engine must slide leftward to -6 to satisfy the rule. Therefore: ⌊-5.7⌋ = -6. ⌊-5.7⌋ ≠ -5.

Floor Function on Integers

If the raw input passed into the algorithm is already a flawless integer, the engine shuts off immediately.

Examples:

  • ⌊5⌋ = 5
  • ⌊0⌋ = 0
  • ⌊-5⌋ = -5

The strict mathematical definition states “less than OR equal to.” Because 5 is exactly equal to 5, the function fulfills its prime directive instantly and returns the integer unaltered. There is absolutely no movement.

Floor Function and Zero

Let us isolate the microscopic decimal space immediately surrounding zero.

  • ⌊0.9⌋ = 0
  • ⌊0.1⌋ = 0
  • ⌊0⌋ = 0
  • ⌊-0.1⌋ = -1
  • ⌊-0.9⌋ = -1

This demonstrates exactly how the engine crosses the boundary. A tiny positive fraction like 0.1 slides leftward and hits 0. But a tiny negative fraction like -0.1 cannot stop at 0 because 0 is mathematically greater than -0.1. It must continue sliding leftward until it impacts the solid integer -1.

Floor Function on a Number Line

A physical number line solves all the confusion instantly. For any non-integer number, you simply identify the greatest whole integer positioned strictly to the left.

Plot the number 4.6. It physically sits trapped between 4 and 5. Sliding left to the nearest solid integer gives 4. ⌊4.6⌋ = 4

Plot the number -4.6. It physically sits trapped between -5 and -4. Sliding left to the nearest solid integer gives -5. ⌊-4.6⌋ = -5

Always slide left.

Floor Function vs Rounding

You must separate the floor function from ordinary nearest-value rounding.

Nearest rounding measures the physical distance to both neighboring integers and snaps to whichever is closer. Floor ignores distance completely and always slides left.

Take the number 4.7.

  • Floor: ⌊4.7⌋ = 4
  • Nearest integer rounding: 4.7 → 5

Take the negative number -4.7.

  • Floor: ⌊-4.7⌋ = -5
  • Nearest integer rounding: -4.7 → -5

In the negative example, they happen to land on the same number. But if we used -4.2, nearest rounding would go to -4, while Floor would ruthlessly slide left to -5. They are completely different operations.

Floor Function vs Truncation

This is perhaps the most critical distinction in computer science. Truncation means brutally severing the decimal tail and letting the number collapse inward toward zero.

For positive numbers, floor and truncation toward zero often produce the identical visual result. Target: 5.7

  • Floor: ⌊5.7⌋ = 5
  • Truncate: 5.7 → 5

But for negative numbers, they completely detach from each other. Target: -5.7

  • Floor: ⌊-5.7⌋ = -6 (Slides left)
  • Truncate toward zero: -5.7 → -5 (Erases the decimal, pulling it inward)
NumberFloorTruncation
5.755
-5.7-6-5

Floor Function vs Ceiling Function

Ceiling and floor are direct mathematical opposites.

Floor

  • ⌊5.7⌋ = 5
  • ⌊-5.7⌋ = -6

Ceiling

  • ⌈5.7⌉ = 6
  • ⌈-5.7⌉ = -5

Floor always moves the value mathematically toward negative infinity (left). Ceiling always moves the value mathematically toward positive infinity (right). If you want to explore the mathematical properties of the ceiling algorithm deeply, read our complete Ceiling vs Floor Functions tutorial.

Mathematical Definition

For college-level proofs, you must memorize the formal algebraic boundaries.

For a real number x, the floor ⌊x⌋ is the unique integer n such that: n ≤ x < n + 1

Let us test this definition. For x = 5.7: 5 ≤ 5.7 < 6 Therefore: ⌊5.7⌋ = 5. The definition holds perfectly.

For x = -5.7: -6 ≤ -5.7 < -5 Therefore: ⌊-5.7⌋ = -6. The definition locks the correct integer into place.

Important Properties of the Floor Function

The floor function operates under several rigid algebraic boundaries that make complex math much easier.

Property 1 ⌊x⌋ ≤ x < ⌊x⌋ + 1 This guarantees that the raw number (x) will always sit securely trapped between its floor and the integer located immediately above its floor.

Property 2 ⌊n⌋ = n (for every integer n) This proves that perfect whole numbers pass through the engine entirely unaffected.

Property 3 ⌊x⌋ = -⌈-x⌉ This is a beautiful mirror identity. It proves you can calculate the floor of any number by negating the ceiling of its negative counterpart.

Floor Function of Fractions

Passing raw fractions into the engine makes the directional rules obvious.

Examples:

  • ⌊7/3⌋ = 2 (7/3 is roughly 2.333…)
  • ⌊11/4⌋ = 2 (11/4 is exactly 2.75)

Now look at negative fractions:

  • ⌊-7/3⌋ = -3 (Sliding left from -2.333… hits -3)
  • ⌊-11/4⌋ = -3 (Sliding left from -2.75 hits -3)

Negative fractions surprise beginners because they instinctively want to answer -2. Visualizing the number line solves this problem instantly.

Floor Function of Decimal Numbers

Let us test extreme decimal values that push right up against the integer boundary.

Examples:

  • ⌊8.01⌋ = 8
  • ⌊8.99⌋ = 8
  • ⌊-8.01⌋ = -9
  • ⌊-8.99⌋ = -9

Notice how 8.99 is incredibly close to 9, yet the floor function relentlessly forces it down to 8. Similarly, -8.01 is incredibly close to -8, yet the floor function mercilessly shoves it leftward to -9. The engine does not care about physical proximity. It only cares about mathematical direction.

Floor Function in Real-Life Applications

These algorithms dictate massive real-world logistics, particularly when dealing with discrete intervals and completed units.

If a warehouse has 27 items and must divide them into bulk shipping crates that hold exactly 5 items each, how many complete crates can be filled? You calculate 27 / 5. The result is 5.4. Because you cannot ship 0.4 of a crate, you apply the floor function. ⌊27 / 5⌋ = 5

This proves you can form 5 complete groups. You must be clear that the floor operation alone does not calculate the remainder (the 2 leftover items). It only calculates the solid integer baseline.

Other common uses include:

  • Index calculations in databases
  • Mathematical modeling of stair-step physics
  • Pixel coordinate rounding in game engines

Floor Function in Programming

Because of its immense utility in array indexing, almost every programming language provides a native floor operation in its math library.

Common examples:

  • Python: math.floor(x)
  • JavaScript: Math.floor(x)

Programmers must pay incredibly special attention to negative numbers when formatting data coordinates. If a JavaScript UI engine calculates a physical position at -5.7 pixels, Math.floor(-5.7) will shift the element to -6. If the programmer actually wanted -5, they should have used Math.trunc() instead. Using the wrong tool will cause severe visual tearing in rendering algorithms.

Floor Function to Different Precision Levels

You must clearly distinguish the standard theoretical mathematical floor function from generalized floor operations.

The standard floor function ⌊x⌋ always returns a whole integer. However, modern calculators allow you to perform a generalized precision-based floor operation at a specified decimal place.

Floor 5.123 to 2 decimal places: 5.12

Floor 5.129 to 2 decimal places: 5.12

For negative values, the mirror logic applies perfectly: Floor -5.123 to 2 decimal places: -5.13

The negative result is different because the directional engine slides leftward to the next available hundredth. Just remember that a decimal-place floor is a generalized computer operation, not the standard mathematical definition of ⌊x⌋.

Common Mistakes

  • Thinking floor means round to the nearest integer. Correction: Floor ignores distance and slides strictly left.
  • Thinking floor always means moving toward zero. Correction: For negative numbers, floor moves aggressively away from zero.
  • Treating negative numbers like positive numbers. Correction: Always plot negative values on a number line to verify direction.
  • Confusing floor with truncation. Correction: Truncation strictly chops the decimal. Floor slides left.
  • Confusing floor with ceiling. Correction: Floor slides left. Ceiling slides right.
  • Forgetting that integers remain unchanged. Correction: The floor of 7 is exactly 7.
  • Reversing the inequality in the formal definition. Correction: The correct formula is n ≤ x < n + 1.
  • Assuming decimal-place floor is the same as standard floor. Correction: Standard floor only yields whole integers.

Quick Reference Table

Review this concise comparison of operations.

ConceptMeaningExample
FloorGreatest integer ≤ x⌊5.7⌋ = 5
CeilingSmallest integer ≥ x⌈5.7⌉ = 6
TruncationRemoves fractional part toward zero-5.7 → -5
Nearest roundingChooses the closest target5.7 → 6

How to Find the Floor of a Number

Use this simple step-by-step process.

  1. Identify the exact raw number.
  2. Find the two solid integers directly surrounding it on the number line.
  3. Select the greatest integer that is strictly less than or equal to the number (the integer on the left).
  4. That integer is the floor.

Let us run a positive example: ⌊7.83⌋ Since 7 ≤ 7.83 < 8. Therefore: ⌊7.83⌋ = 7.

Let us run a negative example: ⌊-7.83⌋ Since -8 ≤ -7.83 < -7. Therefore: ⌊-7.83⌋ = -8.

Add RoundSolver Calculator Links

To process massive arrays of data instantly, use our built-in mathematical tools.

You can use the dedicated Floor Calculator to isolate this specific logic, or use the generalized Rounding Calculator to quickly toggle between Floor, Ceiling Calculator rules, and standard distance-based algorithms.

If you need to handle long fractional tails on precision coordinates, the Decimal Rounding Calculator handles generalized floor operations flawlessly. To see how these tools clash conceptually, read our broader breakdown on Round Up vs Round Down.

Frequently Asked Questions

What is the floor function?
The floor function evaluates a number and outputs the greatest possible integer that is mathematically less than or equal to that number.
What does ⌊x⌋ mean?
It is the formal mathematical notation for the floor function, commanding you to round the value x downward toward negative infinity.
What is the floor of 5.7?
The floor of 5.7 is 5 because 5 is the largest integer available that is still mathematically smaller than 5.7.
What is the floor of -5.7?
The floor of -5.7 is -6 because the function must slide leftward on the number line to find an integer smaller than the original input.
Is floor the same as rounding down?
In strict mathematics, yes. However, beginners frequently confuse it with Truncation, which acts entirely differently on negative numbers.
Is floor the same as truncation?
No. Truncation blindly chops off the decimal tail. For positive numbers, this matches floor. For negative numbers, it behaves completely differently.
What is the difference between floor and ceiling?
Floor always slides the value leftward toward negative infinity. Ceiling always slides the value rightward toward positive infinity.
Can the floor function return a negative number?
Absolutely. If you input a negative fraction or a negative decimal, the floor function will return a negative integer.
What happens when the input is already an integer?
The function immediately returns the original integer completely unaltered. For example, the floor of 7 is 7.
How does the floor function work in programming?
Most languages provide a built-in method like Math.floor(). It is heavily used in physics engines, pixel mapping, and array indexing to force floating-point coordinates into solid integer boundaries.
← Blog