NUMBER THEORYArithmeticMathematics Calculator
⌊⌋

Floor Function

floor(x) is the greatest integer less than or equal to x. It rounds down toward negative infinity. Compare with ceiling, round, and fractional part.

Concept Fundamentals
⌊x⌋ ≤ x
Definition
{x} = x − ⌊x⌋
Fractional
Start CalculatingEnter a number to compute floor, ceiling, round, and fractional part.

Why This Mathematical Concept Matters

Why: The floor function is fundamental in integer division, array indexing, and modular arithmetic.

How: For positive x, floor truncates the decimal. For negative x, floor rounds toward −∞ (e.g., floor(−2.3) = −3).

  • Integer division: a div b = floor(a/b) in many languages.
  • floor(−2.3) = −3, not −2. Floor always rounds toward −∞.
  • Fractional part {x} = x − floor(x) is used in hashing.

📐 Examples — Click to Load

Enter Number

floor.sh
CALCULATED
$ floor --x=3.7
⌊x⌋
3
⌈x⌉
4
Round
4
Fractional
0.7
Floor Function Calculator
⌊3.7⌋ = 3
numbervibe.com
Share:

Floor vs Ceiling vs Round

Integer vs Fractional

📐 Step-by-Step Breakdown

INPUT
Input x
3.7
Integer part
3
ext{Largest} ext{integer} leq x
RESULT
Result
⌊3.7⌋ = 3
Ceiling
⌈3.7⌉ = 4
Round
round(3.7) = 4
Fractional part
{3.7} = 0.7
x - ⌊x⌋

⚠️For educational and informational purposes only. Verify with a qualified professional.

🧮 Fascinating Math Facts

📐

floor(3.7) = 3 and ceil(3.7) = 4. For integers, floor(n) = ceil(n) = n.

— Basics

💻

Used in integer division: a div b = floor(a/b) in many programming languages.

— Programming

📋 Key Takeaways

  • • floor(x) = greatest integer ≤ x. Rounds down toward negative infinity
  • • For positive x: floor gives the integer part; for negative: floor is less than x
  • • ceil(x) = least integer ≥ x. floor(-x) = -ceil(x)
  • • Fractional part: {x} = x - floor(x), always in [0, 1) for positive x

💡 Did You Know?

📐floor(3.7) = 3 and ceil(3.7) = 4. For integers, floor(n) = ceil(n) = n.Source: Basics
⬇️For negative numbers: floor(-2.3) = -3, since -3 is the greatest integer ≤ -2.3.Source: Negatives
💻Used in integer division: a div b = floor(a/b) in many programming languages.Source: Programming
📊Fractional part {x} = x - floor(x) is used in modular arithmetic and hashing.Source: Applications
🎯trunc(x) equals floor(x) for positive x but differs for negative (trunc(-2.3) = -2).Source: Trunc vs Floor
📚The floor function is also called the greatest integer function.Source: Names

📖 How It Works

The floor function maps x to the greatest integer less than or equal to x. For positive numbers, it truncates the decimal. For negative numbers, it rounds toward negative infinity (e.g., floor(-2.3) = -3).

📝 Worked Example: floor(-2.3)

Step 1: -2.3 lies between -3 and -2

Step 2: Greatest integer ≤ -2.3 is -3

Result: ⌊-2.3⌋ = -3

⚠️ Common Mistakes to Avoid

  • floor(-2.3) = -2: Wrong. floor(-2.3) = -3. Floor rounds toward -∞.
  • Confusing with trunc: trunc(-2.3) = -2; floor(-2.3) = -3.
  • Fractional part for negatives: {x} = x - floor(x) can exceed 1 for negative x.

🎯 Expert Tips

💡 Negative numbers

floor(-2.3) = -3, not -2. Floor always rounds toward -∞.

💡 Integer division

In Python, a // b = floor(a/b). JavaScript: Math.floor(a/b).

❓ FAQ

What is the floor function?

floor(x) is the greatest integer less than or equal to x. It rounds down toward negative infinity.

How does floor differ from trunc?

For positive x they match. For negative: floor(-2.3) = -3, trunc(-2.3) = -2.

What is the fractional part?

{x} = x - floor(x). For 3.7, fractional part is 0.7.

When is floor used in programming?

Integer division (a // b), array indexing, pagination, and hashing.

What is the relationship between floor and ceiling?

floor(-x) = -ceil(x). For any real x: floor(x) ≤ x ≤ ceil(x).

⚠️ Disclaimer: For educational use. Uses JavaScript Math.floor which has floating-point precision limits for very large numbers.

👈 START HERE
⬅️Jump in and explore the concept!
AI