The floor function is everywhere in computing and counting: the number of complete boxes you can fill, a person’s age in whole years, array indices and integer division all use it.
How to use the Floor Function Calculator
- x
Results update as you type, and everything is calculated in your browser.
How it works
Positive numbers simply lose their fractional part; negative numbers move away from zero: ⌊−2.3⌋ = −3.
Tips
- Estimate the answer first so you can spot an impossible result.
- Work with whole numbers where possible and place the decimal point at the end.
- Use the order of operations: brackets, powers, multiplication and division, then addition and subtraction.
- For large integers, the calculator works with exact whole-number arithmetic in your browser.
Common mistakes to avoid
- Misaligning decimal points when adding or subtracting.
- Forgetting the remainder in whole-number division.
- Rounding too early in a multi-step calculation.
What each result means
- Floor of x = floor([x])
- Fractional part {x} = [x] – floor([x])
- Ceiling of x = ceil([x])
- Truncated (towards zero) = trunc([x])
Example values
How the main result changes when x changes and everything else stays at the example values above:
| x | Floor of x |
|---|---|
| -1.15 | -2 |
| -1.72 | -2 |
| -2.3 | -3 |
| -2.88 | -3 |
| -3.45 | -4 |
| -4.6 | -5 |
Formula
⌊x⌋ = the greatest integer n with n ≤ x{x} = x − ⌊x⌋Worked example
Inputs — x: -2.3.
Results — Floor of x = -3; Fractional part {x} = 0.7; Ceiling of x = -2; Truncated (towards zero) = -2.
Key terms
- Floor function
- ⌊x⌋, the greatest integer ≤ x.
Frequently asked questions
What is the floor of 3.9?
3.
What is the floor of −3.1?
−4.
How do floor and truncation differ?
They agree for positive numbers; for negatives, floor goes down and truncation goes towards zero.
What is the fractional part of −2.3?
0.7, because −2.3 − (−3) = 0.7.
What formula does the Floor Function Calculator use?
⌊x⌋ = the greatest integer n with n ≤ x.