Beginner

Floor Function Calculator — ⌊x⌋, Ceiling and Fractional Part

Enter any real number to find its floor (⌊x⌋ — greatest integer ≤ x), ceiling (⌈x⌉ — smallest integer ≥ x), fractional part, nearest-integer rounding and truncation all at once.
Any real number, positive or negative (e.g. 3.7, −2.3, 5)
Floor ⌊x⌋
3

Greatest integer less than or equal to x

Ceiling ⌈x⌉
4
Round (nearest integer)
4
Truncate ⌊|x|⌋ toward 0
3
Fractional part {x} = x − ⌊x⌋
0.7
22.42.83.13.53.94.34.65⌊x⌋ = 3x⌈x⌉ = 4x lies between its floor and ceiling on the number line
Step by step
  1. 1

    Floor ⌊x⌋ — greatest integer ≤ x

    ⌊3.7⌋ = 3
    Rounds toward −∞: ⌊3.7⌋ = 3, ⌊−2.3⌋ = −3.
  2. 2

    Fractional part {x} = x − ⌊x⌋

    3.7 − (3) = 0.7
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

How does this calculator work?

Floor ⌊x⌋ = greatest integer ≤ x. ⌊3.7⌋ = 3; ⌊−2.3⌋ = −3. Ceiling ⌈x⌉ = smallest integer ≥ x; ⌈3.7⌉ = 4. Fractional part {x} = x − ⌊x⌋ ∈ [0, 1). For negative numbers floor differs from truncation: floor rounds toward −∞, truncation rounds toward 0.

Formula
⌊x⌋ = max { n ∈ ℤ | n ≤ x } • ⌈x⌉ = min { n ∈ ℤ | n ≥ x } • {x} = x − ⌊x⌋
How this is calculated

The floor function ⌊x⌋ (also called the greatest-integer function [x]) returns the largest integer that does not exceed x. For positive numbers it strips the decimal part: ⌊3.7⌋ = 3. For negative numbers it moves further from zero: ⌊−2.3⌋ = −3, not −2, because −3 ≤ −2.3 but −2 > −2.3. The fractional part {x} = x − ⌊x⌋ is always in [0, 1) regardless of the sign of x.

The ceiling function ⌈x⌉ is the smallest integer that is not less than x — the mirror image of floor. For any non-integer x, ⌈x⌉ = ⌊x⌋ + 1. For integers, ⌊x⌋ = ⌈x⌉ = x. Truncation (also called int() in many languages) rounds toward zero: trunc(3.7) = 3 and trunc(−2.3) = −2. Floor and truncation agree for non-negative numbers but differ for negatives — floor(−2.3) = −3 while trunc(−2.3) = −2.

These functions appear throughout programming (array indexing, modular arithmetic, scheduling), number theory (Gauss brackets, Beatty sequences, floor-division identities) and everyday tasks like rounding prices, calculating full boxes from a quantity, or finding the week number of a date.

Frequently asked questions

For positive x they are the same: both return the integer part. For negative x they differ: floor(−2.3) = −3 (round away from zero toward −∞) while trunc(−2.3) = −2 (round toward zero). In mathematical contexts floor is usually preferred; in C/Java/JavaScript int() and Math.trunc() both truncate.

The fractional part is defined as {x} = x − ⌊x⌋, which is always in [0, 1). For negative numbers this can seem surprising: {−2.3} = −2.3 − (−3) = 0.7, not 0.3. This ensures {x} is always non-negative and {x} + ⌊x⌋ = x always holds.

Floor appears in integer division (Python's // operator), array index computation (n = ⌊log₂ k⌋ to choose a row in a segment tree), page-count calculations (⌈items / pageSize⌉), hash-table sizing, and anywhere you need the "how many full groups fit?" answer. Math.floor() in JavaScript, floor() in C, and int() in Python all implement it.

Also known as

floor function calculator
ceiling function calculator
greatest integer function
floor and ceiling math calculator
fractional part calculator
floor ceil calculator
round down to integer
floor function math

APA

TG we-Calculate Editorial Team. (2026). Floor Function Calculator — ⌊x⌋, Ceiling and Fractional Part [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/floor-function-calculator

Chicago

TG we-Calculate Editorial Team. "Floor Function Calculator — ⌊x⌋, Ceiling and Fractional Part." TG we-Calculate. 2026. https://we-calculate.com/calculator/floor-function-calculator.

IEEE

TG we-Calculate Editorial Team, "Floor Function Calculator — ⌊x⌋, Ceiling and Fractional Part," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/floor-function-calculator

BibTeX

@misc{wecalculate_floor_function_calculator, title = {Floor Function Calculator — ⌊x⌋, Ceiling and Fractional Part}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/floor-function-calculator}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?