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

Did our AI summary help? Let us know.

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.

Key quantities
โŒŠxโŒ‹ โ‰ค x
Definition
Key relation
{x} = x โˆ’ โŒŠxโŒ‹
Fractional
Key relation

Ready to run the numbers?

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 โˆ’โˆž.

Run the calculator when you are ready.

Start CalculatingEnter a number to compute floor, ceiling, round, and fractional part.

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

Related Calculators