Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Integer and Fractional Part






Splitting a Number in Two

Every real number is an integer plus a part between 00 and 11: 3.7=3+0.73.7 = 3 + 0.7. The integer part is the floor ⌊x⌋\lfloor x \rfloor, and what is left is the fractional part {x}\{x\}. For positive numbers both are what one would expect. For negative numbers the standard definitions give ⌊−3.7⌋=−4\lfloor -3.7 \rfloor = -4 and {−3.7}=0.3\{-3.7\} = 0.3, and most of this page is about why. The page also covers the ceiling, rounding, and the link to division and modulo.

Key Terms

Floor— the greatest integer less than or equal to a number; also called the integer part
Ceiling— the least integer greater than or equal to a number
Fractional Part— what remains after the floor is subtracted, always between 00 and 11
Remainder— computed from the floor of a quotient

See All Arithmetic Definitions →


The Integer Part (Floor)

The integer part of a real number xx, also called its floor, is the greatest integer that is less than or equal to xx. It is written ⌊x⌋\lfloor x \rfloor.

The Integer Part (Floor)
⌊x⌋=nwhere n is the integer with n≤x<n+1\lfloor x \rfloor = n \quad \text{where } n \text{ is the integer with } n \leq x < n + 1

On the number line, the floor is found by moving left from xx to the nearest integer, or staying put if xx is already an integer.

Example
⌊3.7⌋=3\lfloor 3.7 \rfloor = 3,   ⌊5⌋=5\; \lfloor 5 \rfloor = 5,   ⌊π⌋=3\; \lfloor \pi \rfloor = 3,   ⌊0.99⌋=0\; \lfloor 0.99 \rfloor = 0.

Pitfall: Dropping the decimals of a negative number
Writing ⌊−3.7⌋=−3\lfloor -3.7 \rfloor = -3. But −3-3 is greater than −3.7-3.7, so it is not below it. The greatest integer below −3.7-3.7 is −4-4.

For negative numbers, moving left means moving away from zero. The integers just around −3.7-3.7 are −4-4 and −3-3, and only −4-4 is at most −3.7-3.7:

Example
⌊−3.7⌋=−4\lfloor -3.7 \rfloor = -4,   ⌊−0.2⌋=−1\; \lfloor -0.2 \rfloor = -1,   ⌊−5⌋=−5\; \lfloor -5 \rfloor = -5.

Older books write the floor as [x][x] and call it the greatest integer function. The notation ⌊x⌋\lfloor x \rfloor, with bars that have only a bottom edge, shows the direction: down.

The Ceiling

The ceiling is the mirror image of the floor: the least integer that is greater than or equal to xx, written ⌈x⌉\lceil x \rceil.

The Ceiling
⌈x⌉=nwhere n is the integer with n−1<x≤n\lceil x \rceil = n \quad \text{where } n \text{ is the integer with } n - 1 < x \leq n

On the number line, the ceiling is found by moving right to the nearest integer, or staying put at an integer.

Example
⌈3.2⌉=4\lceil 3.2 \rceil = 4,   ⌈5⌉=5\; \lceil 5 \rceil = 5,   ⌈−3.2⌉=−3\; \lceil -3.2 \rceil = -3,   ⌈−0.9⌉=0\; \lceil -0.9 \rceil = 0.

For an integer, floor and ceiling are equal. For any other number, the ceiling is exactly one more than the floor: ⌈x⌉=⌊x⌋+1\lceil x \rceil = \lfloor x \rfloor + 1.

Pitfall: Adding 1 to an integer
Using ⌈x⌉=⌊x⌋+1\lceil x \rceil = \lfloor x \rfloor + 1 for every xx gives ⌈5⌉=6\lceil 5 \rceil = 6. At an integer nothing moves: ⌈5⌉=5\lceil 5 \rceil = 5.

The two are linked by a sign change: ⌈x⌉=−⌊−x⌋\lceil x \rceil = -\lfloor -x \rfloor. Negating flips the number line, so moving right becomes moving left.
Number line: the floor of 2.6 is 2 and its ceiling 3; the floor of −2.3 is −3 and its ceiling −2 −4−3−2−11234⌊2.6⌋ = 2⌈2.6⌉ = 3⌊−2.3⌋ = −3⌈−2.3⌉ = −2Floor goes left, ceiling goes right
Floor and ceiling on the number line

The amber dots are 2.6 and −2.3. The upper segments run left to the floor, the lower ones right to the ceiling. For −2.3, moving left reaches −3, so ⌊−2.3⌋ = −3: the floor of a negative number is further from zero than the number.


The Fractional Part

The fractional part of xx is what is left after the integer part is taken away. It is written {x}\{x\}.

The Fractional Part
{x}=x−⌊x⌋,0≤{x}<1\{x\} = x - \lfloor x \rfloor, \qquad 0 \leq \{x\} < 1

Every real number splits into its two parts: x=⌊x⌋+{x}x = \lfloor x \rfloor + \{x\}. The integer part says which unit interval xx is in; the fractional part says how far xx is from the left end of that interval.

Example
{3.7}=3.7−3=0.7\{3.7\} = 3.7 - 3 = 0.7,   {5}=0\; \{5\} = 0,   {π}=π−3≈0.14159\; \{\pi\} = \pi - 3 \approx 0.14159.

Pitfall: A negative fractional part
Writing {−3.7}=−0.7\{-3.7\} = -0.7. With the floor ⌊−3.7⌋=−4\lfloor -3.7 \rfloor = -4, the fractional part is −3.7−(−4)=0.3-3.7 - (-4) = 0.3, never negative.

For a negative number the fractional part is not the digits after the decimal point:

Example
{−3.7}=−3.7−⌊−3.7⌋=−3.7−(−4)=0.3\{-3.7\} = -3.7 - \lfloor -3.7 \rfloor = -3.7 - (-4) = 0.3. On the number line, −3.7-3.7 lies 0.30.3 to the right of −4-4.

Some calculators and texts define the fractional part of a negative number as xx minus its truncation, which gives −0.7-0.7 here and keeps the sign. The definition with the floor is the standard one in mathematics, and the only one with 0≤{x}<10 \leq \{x\} < 1 for every xx.
Every real number is its floor plus its fractional part, x=⌊x⌋+{x}x = \lfloor x \rfloor + \{x\}, and the fractional part is never negative.

Integer Part Notation

Notation

Integer Part Notation

Brackets that keep only one edge, braces for what is left over, and a rounding rule built from the floor — the page's four ways of cutting a real number to an integer.
The condition n≤x<n+1n \leq x < n + 1 is a half-open interval, read as in interval notation; remainders come from divisibility notation.
⌊x⌋\lfloor x \rfloor
floor of x — the integer part of x
The greatest integer at most xx: the integer nn with n≤x<n+1n \leq x < n + 1. Only the bottom edges of the brackets are drawn — the direction is down, toward −∞-\infty, never toward zero.
CasesFor negative inputs, down means away from zero: ⌊−3.7⌋=−4\lfloor -3.7 \rfloor = -4, not −3-3. At an integer nothing moves: ⌊5⌋=5\lfloor 5 \rfloor = 5.
Also written[x][x] — older books, under the name greatest integer function. floor(x)\text{floor}(x), INT(x)\text{INT}(x) — calculators, spreadsheets and code (section 10).
Do not confuseTruncation. Cutting off the decimals agrees with the floor only for x≥0x \geq 0: truncating −3.7-3.7 gives −3-3, the floor gives −4-4.
Same glyph elsewhere[x][x] — the old floor — is also plain grouping brackets and, with two entries, the closed interval [a,b][a, b]. The one-edged brackets replaced it for that reason.
⌈x⌉\lceil x \rceil
ceiling of x
The least integer at least xx: the integer nn with n−1<x≤nn - 1 < x \leq n. Top edges only — the direction is up, toward +∞+\infty.
CasesOff the integers, ⌈x⌉=⌊x⌋+1\lceil x \rceil = \lfloor x \rfloor + 1; on an integer the two coincide, ⌈5⌉=5\lceil 5 \rceil = 5. The mirror rule ⌈x⌉=−⌊−x⌋\lceil x \rceil = -\lfloor -x \rfloor turns any ceiling into a floor.
Also writtenceil(x)\text{ceil}(x), CEILING(x)\text{CEILING}(x) — calculators and code.
Do not confuseRounding away from zero. For negatives the ceiling moves toward zero: ⌈−3.2⌉=−3\lceil -3.2 \rceil = -3, not −4-4.
{x}\{x\}
fractional part of x
What the floor leaves behind: {x}=x−⌊x⌋\{x\} = x - \lfloor x \rfloor, always with 0≤{x}<10 \leq \{x\} < 1. The two brackets rebuild the number: x=⌊x⌋+{x}x = \lfloor x \rfloor + \{x\}.
CasesNegative inputs: {−3.7}=0.3\{-3.7\} = 0.3, not −0.7-0.7 — the digits after the point are not the fractional part. Every integer has {x}=0\{x\} = 0.
Also writtenfrac(x)\text{frac}(x); x mod 1x \bmod 1 — the remainder on division by 11.
Do not confuseThe truncation version some calculators use, which returns −0.7-0.7 for −3.7-3.7 and breaks the range 0≤{x}<10 \leq \{x\} < 1.
Same glyph elsewhereSet braces: {x}\{x\} is also the one-element set holding xx. Where both could appear, write frac(x)\text{frac}(x).
round(x)=⌊x+12⌋\text{round}(x) = \left\lfloor x + \tfrac{1}{2} \right\rfloor
x rounded to the nearest integer
Rounding built from the floor: shift by one half, then floor. This version sends ties up: 2.5→32.5 \to 3, −2.5→−2-2.5 \to -2.
CasesThree tie rules are in use — half up, half away from zero, half to even (section 5). They disagree only at exact halves.
Also written⌊x⌉\lfloor x \rceil — mixed brackets, occasionally used for the nearest integer; ROUND(x,0)\text{ROUND}(x, 0) in spreadsheets.
Do not confuseRounding in code. Python sends 2.52.5 to 22 (half to even), while the formula above gives 33.

Negative Numbers

For positive numbers, the floor is the same as dropping the digits after the decimal point. For negative numbers it is not, and this is where almost every mistake with floor and fractional part happens.

Dropping the decimals, called truncation, always moves toward zero. The floor always moves down. For positive numbers down is toward zero, so the two agree; for negative numbers down is away from zero, so they differ by one.

RULE
For a negative number that is not an integer, truncation gives the ceiling, not the floor: dropping the decimals of −3.7-3.7 gives −3=⌈−3.7⌉-3 = \lceil -3.7 \rceil.

The table compares the operations on pairs of opposite numbers. The fractional parts of 3.73.7 and −3.7-3.7 are 0.70.7 and 0.30.3, which add up to 11; for every non-integer xx, {x}+{−x}=1\{x\} + \{-x\} = 1.

The same difference splits modulo of negative numbers into two conventions: truncated division rounds the quotient toward zero, floored division rounds it down.
x⌊x⌋ (floor)⌈x⌉ (ceiling)drop the decimals{x} (fractional part)
3.73430.7
−3.7−4−3−30.3
0.50100.5
−0.5−1000.5
55550
−5−5−5−50

Rounding to the Nearest Integer

    Rounding picks the nearest integer. Floor and ceiling give the two candidates; rounding chooses whichever is closer.

    Rounding to the Nearest Integer
    round(x)=⌊x+12⌋\text{round}(x) = \left\lfloor x + \tfrac{1}{2} \right\rfloor

    Adding 12\frac{1}{2} before taking the floor moves every number whose fractional part is at least 12\frac{1}{2} past the next integer. So 2.42.4 becomes ⌊2.9⌋=2\lfloor 2.9 \rfloor = 2 and 2.62.6 becomes ⌊3.1⌋=3\lfloor 3.1 \rfloor = 3.

    The only real choice is what to do with a tie, a number exactly halfway between two integers. Three rules are in common use:

  • Half up: ties go up, toward +∞+\infty. This is the formula above: 2.5→32.5 \to 3 and −2.5→−2-2.5 \to -2.
  • Half away from zero: ties go away from zero, the usual school rule: 2.5→32.5 \to 3 and −2.5→−3-2.5 \to -3.
  • Half to even: ties go to the even neighbour: 2.5→22.5 \to 2, 3.5→43.5 \to 4. Rounding a long list this way pushes up and down equally often, so totals do not drift; banks, and some programming languages such as Python, use it for that reason.

  • The rules disagree only on ties. For every other number, all three give the nearest integer.
Number line: every number from 1.5 up to but not including 2.5 rounds to 2; from 2.5 up to 3.5 rounds to 3 1234rounds to 2rounds to 32.5Round half up: each integer owns [n − ½, n + ½)
Which numbers round to which integer

Each integer collects the numbers within ½ of it. Under round half up, the tie 2.5 belongs to the interval of 3: the filled dot at 2.5 is on the lower segment, and the hollow dot on the upper one marks that 2.5 does not round to 2.

xfloorceilingtoward zerohalf up ⌊x + ½⌋half away from zerohalf to even
2.4232222
2.5232332
3.5343444
−2.5−3−2−2−2−3−2
−2.6−3−2−2−3−3−3

Properties of Floor, Ceiling and Fractional Part

The rules below hold for every real xx and yy and every integer nn.

RULE
An integer can be moved in and out of the floor: ⌊x+n⌋=⌊x⌋+n\lfloor x + n \rfloor = \lfloor x \rfloor + n. A number that is not an integer cannot.

The second half of the rule is where errors come from. In general ⌊x+y⌋≠⌊x⌋+⌊y⌋\lfloor x + y \rfloor \neq \lfloor x \rfloor + \lfloor y \rfloor: the two fractional parts may add up to more than 11 and carry an extra unit. For the same reason ⌊2x⌋\lfloor 2x \rfloor is not 2⌊x⌋2\lfloor x \rfloor: ⌊2⋅1.6⌋=3\lfloor 2 \cdot 1.6 \rfloor = 3, while 2⌊1.6⌋=22\lfloor 1.6 \rfloor = 2.
PropertyRuleExample
Bounds⌊x⌋ ≤ x < ⌊x⌋ + 1,  equivalently x − 1 < ⌊x⌋ ≤ x⌊2.3⌋ = 2 ≤ 2.3 < 3
Range of the fractional part0 ≤ {x} < 1{−0.1} = 0.9
Integers are fixed⌊n⌋ = ⌈n⌉ = n and {n} = 0 for integer n⌊−4⌋ = −4
Adding an integer⌊x + n⌋ = ⌊x⌋ + n,  {x + n} = {x}⌊7.2⌋ = ⌊0.2⌋ + 7 = 7
Floor and ceiling⌈x⌉ = −⌊−x⌋⌈2.3⌉ = −⌊−2.3⌋ = −(−3) = 3
Gap between them⌈x⌉ − ⌊x⌋ = 0 for integers, 1 otherwise⌈2.3⌉ − ⌊2.3⌋ = 1
Opposites⌊x⌋ + ⌊−x⌋ = 0 for integers, −1 otherwise⌊2.3⌋ + ⌊−2.3⌋ = 2 − 3 = −1
Sums⌊x⌋ + ⌊y⌋ ≤ ⌊x + y⌋ ≤ ⌊x⌋ + ⌊y⌋ + 1⌊0.6 + 0.6⌋ = 1,  ⌊0.6⌋ + ⌊0.6⌋ = 0
Nested division⌊⌊x⌋ / n⌋ = ⌊x / n⌋ for positive integer n⌊⌊7.9⌋ / 2⌋ = ⌊3.5⌋ = 3 = ⌊3.95⌋

The Graphs

The graph of y=⌊x⌋y = \lfloor x \rfloor is a staircase. On each interval [n,n+1)[n, n + 1) the function is constant at nn, so the graph is a horizontal step with a filled dot at the left end, which belongs to the step, and a hollow dot at the right end, which does not. At every integer the graph jumps up by 11.

The graph of y={x}y = \{x\} is a sawtooth. On each interval [n,n+1)[n, n + 1) it equals x−nx - n: it rises with slope 11 from 00 toward 11, then drops back to 00 at the next integer. It repeats with period 11, and its range is [0,1)[0, 1).

Both functions are continuous everywhere except at the integers, where they have jump discontinuities: the limit from the left of ⌊x⌋\lfloor x \rfloor at x=nx = n is n−1n - 1, the limit from the right is nn. Between the integers the floor is constant, so its derivative there is 00.

The step functions section of the function families page and the step functions section of the piecewise functions page treat these graphs as functions.
Staircase graph of y = floor of x: horizontal steps of length 1, filled dot at the left end of each step, hollow dot at the right endxy−3−2−1123−4−3−2−1123y = ⌊x⌋y = ⌊x⌋
The staircase

Each step covers one interval [n, n + 1) at height n. The filled dot shows that the left end belongs to the step; the hollow dot shows that the right end does not, because at the next integer the floor has already jumped up by 1.

Sawtooth graph of the fractional part y = x minus floor of x: on each unit interval it rises from 0 toward 1, then drops back to 0xy−3−2−11231y = {x} = x − ⌊x⌋y = {x}
The sawtooth

Between consecutive integers the fractional part rises with slope 1 from 0 toward 1, never reaching it. At each integer it drops back to 0. The graph to the left of 0 is identical to the graph on the right: {−0.3} = 0.7, the same height as {0.7}.


Floor and Division

Dividing an integer aa by a positive integer nn gives a quotient and a remainder. The floor computes both.

Floor and Division
q=⌊an⌋,r=a−n⌊an⌋=a mod nq = \left\lfloor \frac{a}{n} \right\rfloor, \qquad r = a - n\left\lfloor \frac{a}{n} \right\rfloor = a \bmod n

Example
23÷523 \div 5:   q=⌊4.6⌋=4\; q = \lfloor 4.6 \rfloor = 4 and r=23−5⋅4=3r = 23 - 5 \cdot 4 = 3, so 23=5⋅4+323 = 5 \cdot 4 + 3.

Example
−23÷5-23 \div 5:   q=⌊−4.6⌋=−5\; q = \lfloor -4.6 \rfloor = -5 and r=−23−5⋅(−5)=2r = -23 - 5 \cdot (-5) = 2, so −23=5⋅(−5)+2-23 = 5 \cdot (-5) + 2.

The remainder is also the fractional part of the quotient, scaled back up: r=n{an}r = n \left\{ \frac{a}{n} \right\}. For −23÷5-23 \div 5, {−4.6}=0.4\{-4.6\} = 0.4 and 5⋅0.4=25 \cdot 0.4 = 2.

Because the floor always rounds down, this remainder is always in {0,1,…,n−1}\{0, 1, \ldots, n - 1\}, even for a negative aa. That is the convention used for modulo in mathematics; the modulo calculator shows the steps for any pair of numbers.

Counting with Floor and Ceiling

Many counting questions ask how many whole things fit, or how many are needed. The first kind is answered by a floor, the second by a ceiling.

Example
How many multiples of 77 are there from 11 to 100100?   100÷7≈14.29\; 100 \div 7 \approx 14.29, and ⌊14.29⌋=14\lfloor 14.29 \rfloor = 14: they are 7,14,…,987, 14, \ldots, 98.

Example
5050 students travel in buses that seat 1212.   50÷12≈4.17\; 50 \div 12 \approx 4.17. Full buses: ⌊4.17⌋=4\lfloor 4.17 \rfloor = 4, carrying 4848 students. Buses needed so that nobody is left behind: ⌈4.17⌉=5\lceil 4.17 \rceil = 5.

Example
How many digits does 48214821 have?   log⁡104821≈3.68\; \log_{10} 4821 \approx 3.68, and ⌊3.68⌋+1=4\lfloor 3.68 \rfloor + 1 = 4. In general a positive integer NN has ⌊log⁡10N⌋+1\lfloor \log_{10} N \rfloor + 1 digits.

The test for which one to use: if a part that does not fill a whole group is dropped, use the floor; if it still needs a group of its own, use the ceiling.
Number line from 0 to 60 with multiples of 12 marked: 50 lies between 48 and 60, so 4 full groups of 12 fit and 5 groups are needed 1224364860⌊50 / 12⌋ = 4 full buses⌈50 / 12⌉ = 5 buses5050 students, buses of 12
Floor counts full groups, ceiling counts groups needed

The tick marks are the multiples of 12. The amber dot, 50, lies between 48 and 60. Four full buses carry 48 students; the 2 left over still need a bus of their own, so the number of buses is the next multiple up: 5.


In Calculators and Programming Languages

    Software offers floor, ceiling, truncation and rounding as separate operations, and the names do not always say which is which.

  • Floor and ceiling: floor\texttt{floor} and ceil\texttt{ceil} in most languages, and INT\texttt{INT} in spreadsheets, which rounds down: INT(−3.7)=−4\texttt{INT}(-3.7) = -4.
  • Truncation: converting to an integer type usually truncates. In Python, C and Java, the conversion of −3.7-3.7 gives −3-3; JavaScript has Math.trunc\texttt{Math.trunc}.
  • Integer division: Python's //\texttt{//} floors, so −7  //  2=−4-7 \; \texttt{//} \; 2 = -4. In C and Java, integer division truncates and gives −3-3. JavaScript has no integer division: −7/2=−3.5-7 / 2 = -3.5, and Math.trunc\texttt{Math.trunc} turns it into −3-3.
  • Rounding ties: Python's round\texttt{round} rounds half to even, so round(2.5)=2\texttt{round}(2.5) = 2. JavaScript's Math.round\texttt{Math.round} rounds half up, so Math.round(−2.5)=−2\texttt{Math.round}(-2.5) = -2.

  • Positive test inputs cannot tell these apart. Code that floors, truncates or rounds should always be tested with a negative number and with a value exactly halfway between two integers.

Common Pitfalls

Dropping the decimals of a negative number

The floor of a negative number is found by deleting the digits after the decimal point.

Wrong working: ⌊−3.7⌋=−3\lfloor -3.7 \rfloor = -3.

Right working: the floor is the greatest integer at most −3.7-3.7. Since −3>−3.7-3 > -3.7, it does not qualify; −4≤−3.7-4 \leq -3.7 does. So ⌊−3.7⌋=−4\lfloor -3.7 \rfloor = -4.

Why it happens: for positive numbers, deleting the decimals and taking the floor give the same result, so the floor is remembered as "delete the decimals".

How to check: the floor must not be greater than the number. On the number line, it is on the left of xx or at xx.

A negative fractional part

The fractional part of a negative number is read off as the digits after the decimal point, with a minus sign.

Wrong working: {−3.7}=−0.7\{-3.7\} = -0.7.

Right working: {−3.7}=−3.7−⌊−3.7⌋=−3.7−(−4)=0.3\{-3.7\} = -3.7 - \lfloor -3.7 \rfloor = -3.7 - (-4) = 0.3.

Why it happens: the fractional part is thought of as "the decimal digits" rather than as x−⌊x⌋x - \lfloor x \rfloor.

How to check: the fractional part is always in [0,1)[0, 1), and ⌊x⌋+{x}\lfloor x \rfloor + \{x\} must give back xx: −4+0.3=−3.7-4 + 0.3 = -3.7.

Adding 1 to an integer

The ceiling is computed as the floor plus one, without checking whether xx is an integer.

Wrong working: ⌈5⌉=⌊5⌋+1=6\lceil 5 \rceil = \lfloor 5 \rfloor + 1 = 6, and so ⌈60/12⌉=6\lceil 60 / 12 \rceil = 6 buses for 6060 students in buses of 1212.

Right working: an integer is its own ceiling, ⌈5⌉=5\lceil 5 \rceil = 5: five buses are enough.

Why it happens: ⌈x⌉=⌊x⌋+1\lceil x \rceil = \lfloor x \rfloor + 1 is true for every non-integer, so the exception is forgotten.

How to check: test the case where the division comes out exact.

Splitting the floor over a sum

The floor is distributed over a sum or pulled out of a multiple.

Wrong working: ⌊0.6+0.6⌋=⌊0.6⌋+⌊0.6⌋=0\lfloor 0.6 + 0.6 \rfloor = \lfloor 0.6 \rfloor + \lfloor 0.6 \rfloor = 0, and ⌊2⋅1.6⌋=2⌊1.6⌋=2\lfloor 2 \cdot 1.6 \rfloor = 2 \lfloor 1.6 \rfloor = 2.

Right working: ⌊1.2⌋=1\lfloor 1.2 \rfloor = 1 and ⌊3.2⌋=3\lfloor 3.2 \rfloor = 3. Only an integer term can be taken out: ⌊x+n⌋=⌊x⌋+n\lfloor x + n \rfloor = \lfloor x \rfloor + n.

Why it happens: the floor is treated like a linear operation, such as multiplying by a constant.

How to check: add the fractional parts. If they sum to 11 or more, the floor of the sum is one larger than the sum of the floors.

Summary: Integer and Fractional Part at a Glance

The definitions, the behaviour on negative numbers, the rules and the uses on this page reduce to the table below.
IdeaStatementExample
Floor (integer part)⌊x⌋ is the greatest integer ≤ x⌊3.7⌋ = 3,  ⌊−3.7⌋ = −4
Ceiling⌈x⌉ is the least integer ≥ x⌈3.2⌉ = 4,  ⌈−3.2⌉ = −3
Fractional part{x} = x − ⌊x⌋, always in [0, 1){3.7} = 0.7,  {−3.7} = 0.3
Negative numbersfloor moves down, away from zero; dropping the decimals moves toward zero⌊−3.7⌋ = −4, trunc(−3.7) = −3
Roundingnearest integer; ties need a rule2.5 → 3 (half up) or 2 (half to even)
Integers pass through⌊x + n⌋ = ⌊x⌋ + n⌊7.2⌋ = 7
Divisionq = ⌊a / n⌋,  r = a − n⌊a / n⌋−23 ÷ 5: q = −5, r = 2
Counting⌊N / k⌋ multiples of k up to N; ⌈N / k⌉ groups of k to hold N⌈50 / 12⌉ = 5 buses
Graphs⌊x⌋ is a staircase; {x} is a sawtooth; both jump at every integerjump of 1 at x = 2

Integer and Fractional Part FAQ

What is the fractional part of a negative number?

+
With the standard definition {x} = x − ⌊x⌋, the fractional part is always between 0 and 1. For −3.7 it is −3.7 − (−4) = 0.3, not −0.7. Some calculators use a sign-keeping version instead and give −0.7.Read more →

What is the difference between floor and truncation?

+
Floor rounds down, toward negative infinity; truncation deletes the decimal digits, which rounds toward zero. They agree for positive numbers and differ by one for negative non-integers: ⌊−3.7⌋ = −4, while truncating −3.7 gives −3.Read more →

Why does 2.5 sometimes round to 2?

+
Under the rule round half to even, a number exactly halfway between two integers goes to the even one: 2.5 rounds to 2 and 3.5 to 4. Python's round function and many financial systems use this rule because it keeps totals from drifting upward.Read more →

Does the floor of a sum equal the sum of the floors?

+
No, not in general. The fractional parts can add up to 11 or more and carry an extra unit: ⌊0.6+0.6⌋=1\lfloor 0.6 + 0.6 \rfloor = 1, while ⌊0.6⌋+⌊0.6⌋=0\lfloor 0.6 \rfloor + \lfloor 0.6 \rfloor = 0. The floor of the sum is always equal to the sum of the floors or one more. Only an integer can be moved out freely, ⌊x+n⌋=⌊x⌋+n\lfloor x + n \rfloor = \lfloor x \rfloor + n, so ⌊2⋅1.6⌋=3\lfloor 2 \cdot 1.6 \rfloor = 3 while 2⌊1.6⌋=22\lfloor 1.6 \rfloor = 2.Read more →

Should you use floor or ceiling in a word problem?

+
It depends on what happens to the part left over. If an incomplete group is simply dropped, use the floor; if it still needs a group of its own, use the ceiling. With 5050 students and buses seating 1212, 50÷12≈4.1750 \div 12 \approx 4.17: ⌊4.17⌋=4\lfloor 4.17 \rfloor = 4 buses are full, but ⌈4.17⌉=5\lceil 4.17 \rceil = 5 buses are needed. When the division is exact, as with 6060 students, both give 55.Read more →

Does the INT function in a spreadsheet round negative numbers down?

+
Yes. Spreadsheet INT\texttt{INT} is the floor, so INT(−3.7)=−4\texttt{INT}(-3.7) = -4, not −3-3. Converting −3.7-3.7 to an integer type in Python, C or Java truncates instead and gives −3-3. Integer division splits the same way: Python's //\texttt{//} floors, so −7  //  2=−4-7 \; \texttt{//} \; 2 = -4, while C and Java truncate to −3-3. Positive inputs cannot tell these apart, so test with a negative number.Read more →