Ceiling Function Calculator

Enter a real number x. The calculator computes ⌈x⌉ — the least integer n ≥ x, toward +∞. ⌈3.2⌉ = 4; ⌈−1.2⌉ = −1 (not −2); ⌈5⌉ = 5. This is not floor (toward −∞), not trunc toward zero, and not rounding to n decimal places or to a multiple like Excel CEILING.

Input

Result

Enter x, for example 3.2 or −1.2.

The calculator returns rounding up toward +∞. For negative non-integers the result differs from floor (which steps toward −∞). A whole x stays itself.

How it works

How ⌈3.2⌉ is computed
x3.2
n−1 < x ≤ n3 < 3.2 ≤ 4
⌈x⌉4

The ceiling function, written ⌈x⌉ (Iverson’s notation popularized by Donald Knuth), is the least integer that is not smaller than x. Formally: ⌈x⌉ = n ∈ ℤ if and only if n−1 < x ≤ n. For x = 3.2 we have 3 < 3.2 ≤ 4, so ⌈3.2⌉ = 4. When x is already an integer the interval is (x−1, x], so ⌈5⌉ = 5.

For negatives, ceiling does not run farther into the minus side. ⌈−1.2⌉ = −1, because −2 < −1.2 ≤ −1; −2 is already smaller than −1.2. Floor ⌊−1.2⌋ = −2, and trunc (Math.trunc) would give −1. That gap versus floor is the most common classroom and coding trap.

The dual identity links both functions: ⌈x⌉ = −⌊−x⌋. Hence the result panel also shows floor and trunc beside the primary ceiling. The gap n − x (with n = ⌈x⌉) is how much must be added to reach the integer ceiling; for an integer x it is 0.

The calculator uses the number x you enter in the “Number x” field. The calculator computes ⌈x⌉ — matching the mathematical ceiling for finite numbers. A comma and a period are equivalent.

The mathematical model is the classical ceiling (round-up) function from real analysis and from Concrete Mathematics (Graham, Knuth, Patashnik). NIST DLMF §1.4 lists ceiling among elementary functions. Do not confuse it with rounding to n decimal places, which keeps a fraction, or with round-to-nearest.

Reference examples: ⌈3.2⌉ = 4, ⌈−1.2⌉ = −1, ⌈5⌉ = 5, ⌈0.1⌉ = 1, ⌈−0.1⌉ = 0, ⌈−3⌉ = −3. The result panel also shows floor, trunc, n − x, and the interval (n−1, n], and the diagram places x on the number line against the ceiling step.

Formula

⌈x⌉ = n, where n ∈ ℤ and n−1 < x ≤ n.

Equivalently: ⌈x⌉ = min{ k ∈ ℤ : k ≥ x }. Symbol x is the entered number (the “Number x” field). Symbol n is the integer result. Duality: ⌈x⌉ = −⌊−x⌋.

Computation: ⌈x⌉. Mathematical model: ceiling (round-up) function — NIST DLMF §1.4; Concrete Mathematics (Graham, Knuth, Patashnik).

Theory, floor/trunc, and negatives

Definition

Rounding up in the ceiling sense, written ⌈x⌉ (or ceil(x)), is the least integer not smaller than x. Formally: ⌈x⌉ = min{ n ∈ ℤ : n ≥ x }. The equivalent interval statement is n−1 < x ≤ n, where n = ⌈x⌉. For x = 3.2 we have 3 < 3.2 ≤ 4, so ⌈3.2⌉ = 4. When x is already an integer the result equals x: ⌈5⌉ = 5.

The definition of ceiling (and the dual floor ⌊x⌋) is standard in NIST DLMF §1.4 (Elementary Special Functions — Floor and Ceiling), Graham–Knuth–Patashnik Concrete Mathematics, and MathWorld (Ceiling Function). The calculator computes ceil — the same function the browser provides. “Up” means toward +∞ on the number line, not “away from zero”: for −1.2 the result is −1, not −2.

In classroom practice it helps to separate the mathematical formula from floating-point arithmetic limits: this calculator reports ceil in the browser, not a CAS identity on paper. For extreme |x|, check first whether a fractional part is still representable in computer arithmetic 754.

Historical and conceptual context

The notation ⌈x⌉, like ⌊x⌋, was popularized by Kenneth E. Iverson (APL) and then by Donald Knuth and coauthors of Concrete Mathematics. Older texts described “the least integer ≥ x” without a uniform symbol; computing settled on the name ceiling / ceil. In memory allocation, page counts, or full packs (⌈n/k⌉), ceiling appears naturally as “how many units are needed to cover demand from above.”

Conceptually ceiling is not rounding to the nearest integer. It is also not truncation toward zero. Trunc on −1.2 gives −1 — matching ceil — but on +3.2 it gives 3, while ceil gives 4. Floor on −1.2 gives −2. The three functions agree on nonnegative integers and diverge elsewhere.

School language sometimes confuses “round up” with “always move away from zero.” That is false: ⌈−1.2⌉ = −1 is closer to zero than −2. “Up” means motion toward positive infinity on the axis.

Formal properties

Domain: ℝ (in practice finite floating-point numbers). Codomain: ℤ. The function is nondecreasing, left-continuous, with jumps at the integers. ⌈x⌉ = x ⇔ x ∈ ℤ.

Basic identities: ⌈x⌉ − 1 < x ≤ ⌈x⌉; ⌈x + n⌉ = ⌈x⌉ + n for n ∈ ℤ; ⌈−x⌉ = −⌊x⌋ and ⌊−x⌋ = −⌈x⌉. Hence the duality ⌈x⌉ = −⌊−x⌋ is an identity, not an approximation.

For non-integer x, ⌈x⌉ = ⌊x⌋ + 1; for integer x both agree. So ⌈x⌉ − ⌊x⌋ belongs to {0, 1}. Trunc (toward zero) matches floor on [0, ∞) and ceil on (−∞, 0].

In positive integer arithmetic, ⌈a/b⌉ = ⌊(a + b − 1)/b⌋ is the classic trick without floating point; this calculator, however, computes ceil of one real x, not a quotient of two integers.

Full derivation

Step 1. The set { n ∈ ℤ : n ≥ x } is nonempty and bounded below by x, so a minimum exists in ℤ — call it ⌈x⌉.

Step 2. By definition of the minimum: ⌈x⌉ ≥ x and ⌈x⌉ − 1 < x (because ⌈x⌉ − 1 is no longer in the set), hence n−1 < x ≤ n with n = ⌈x⌉.

Step 3 (integer shift). If k ∈ ℤ, then m ≥ x ⇔ m + k ≥ x + k, so the minimum shifts by k: ⌈x + k⌉ = ⌈x⌉ + k.

Step 4 (duality with floor). Let n = ⌊−x⌋. Then n ≤ −x < n + 1, so −n − 1 < x ≤ −n. The number −n is the least integer ≥ x, i.e. ⌈x⌉ = −n = −⌊−x⌋.

Step 5 (negative example). For x = −1.2 the integers ≥ −1.2 are −1, 0, 1, …; the minimum is −1. Floor chooses the maximum among integers ≤ −1.2, namely −2. Trunc clips toward zero and also gives −1 — agreeing with ceil here only by coincidence of signs.

Special cases

Examples: ⌈3.2⌉ = 4; ⌈5⌉ = 5; ⌈0.1⌉ = 1; ⌈−0.1⌉ = 0; ⌈−1.2⌉ = −1; ⌈−3⌉ = −3. On the integers, ceiling is the identity.

Limits: as x → n⁺ for an integer n, ⌈x⌉ = n + 1 just to the right of the jump; as x → n⁻, ⌈x⌉ = n. The step graph is left-continuous (unlike floor, which is right-continuous).

Near zero: ⌈0⌉ = 0; ⌈0.0001⌉ = 1; ⌈−0.0001⌉ = 0. That shows “up” does not mean “always move away from zero.”

Numerical and computational notes

ceil operates on floating-point numbers. For |x| > 2⁵³ not every integer is exactly representable — then “ceil” acts on an already rounded machine value. A comma and a period in the field are equivalent.

The result panel shows floor, trunc, the gap n − x, and the interval (n−1, n]. The calculator does not compute ⌈a/b⌉ from two fields, modulo, or round-to-n — only ⌈x⌉ from one argument.

In JavaScript ⌈+0⌉ = +0 and ⌈−0⌉ = −0 in the signed-zero sense; this page displays the integer without a separate “negative zero” label.

Related notions and sources

Related: integer part (floor) ⌊x⌋, fractional part {x} = x − ⌊x⌋, rounding to n places, trunc toward zero. Round-to-nearest is a separate model with tie-breaking rules.

Sources: NIST Digital Library of Mathematical Functions §1.4 (Floor and Ceiling); Graham, Knuth, Patashnik — Concrete Mathematics (floor/ceiling chapters); MathWorld — Ceiling Function; ECMAScript Language Specification — Math.ceil; Wikipedia — Floor and ceiling functions. Educational tool.

How to use

  1. Enter x in the Number x field, for example 3.2 or −1.2.
  2. Click Calculate or wait for the live result. 3.2 gives 4. −1.2 gives −1.
  3. Check the panel: floor, trunc, the gap n − x, and the interval (n−1, n]. The number-line diagram marks x and ⌈x⌉.
  4. Whole 5 stays 5. 0.1 gives 1. −0.1 gives 0.
  5. Floor of the same x is on the neighbouring integer-part page; rounding to n places is on a separate calculator.

Symbol glossary

Ceil returns the least integer ≥ x. ⌈3.2⌉ = 4. ⌈−1.2⌉ = −1. Floor at −1.2 would be −2.

⌈x⌉
Ceiling: least n ∈ ℤ with n ≥ x. Primary result field.
x
Number in the “Number x” field. 3.2, −1.2, 5, 0.1…
n − x
How much to add to reach ⌈x⌉. For 3.2 it is 0.8; for integer x it is 0.
trunc
Truncation toward zero (trunc). Differs from ceil on positive non-integers; may match ceil on negative non-integers.

Examples

Example 1

  • x = 3.2

4

What is ⌈3.2⌉? 4 (floor = 3).

Example 2

  • x = −1.2

−1

What is ⌈−1.2⌉? −1 (floor = −2).

Example 3

  • x = 5

5

What is ⌈5⌉? 5 (integer x unchanged).

Example 4

  • x = 0.1

1

What is ⌈0.1⌉? 1.

Example 5

  • x = −0.1

0

What is ⌈−0.1⌉? 0 (floor = −1).

Example 6

  • x = −3

−3

What is ⌈−3⌉? −3 (negative integer unchanged).

Related calculators

Frequently asked questions

What does ⌈x⌉ (ceiling, round up) mean?

⌈x⌉ is the least integer n such that n ≥ x. Equivalently: n−1 < x ≤ n. The calculator returns that integer; the gap n − x is how much must be added to reach the ceiling.

What is ⌈3.2⌉?

The result is 4. Four satisfies 3 < 3.2 ≤ 4, and three does not, because 3 < 3.2. That is the first worked example on this page.

What is ⌈−1.2⌉, and why not −2?

The result is −1, not −2. Ceiling steps toward +∞: −2 < −1.2 ≤ −1, while −2 is already smaller than −1.2. Floor of the same x would be −2.

How does ceil differ from floor, trunc, and int?

Floor ⌊x⌋ is the greatest integer ≤ x. Trunc drops the fraction toward zero. “Int” in some languages aliases trunc or floor — here it is always ceil. For −1.2: ceil = −1, floor = −2, trunc = −1.

What is the identity with floor?

⌈x⌉ = −⌊−x⌋. The result panel also shows floor and trunc beside the primary ceiling so you can see that relationship on numbers.

What are ⌈5⌉, ⌈0.1⌉, and ⌈−0.1⌉?

⌈5⌉ = 5 (a whole x stays itself). ⌈0.1⌉ = 1. ⌈−0.1⌉ = 0, because −1 < −0.1 ≤ 0.

How does ceil behave in computer arithmetic?

The browser calls ⌈x⌉ on a floating-point number. For finite x the result matches mathematical ceiling; very large |x| may already lose fractional bits in the floating-point representation itself.

Does a comma in 3.2 work?

Yes. 3.2 and 3,2 both give 4. The field accepts US and European decimal writing.

Do the currency and unit settings in the page header affect the result?

No. The result depends only on the entered x. The currency and unit settings in the page header do not affect this result.

Where do the definition and the ⌈x⌉ notation come from?

Iverson/Knuth bracket notation is standard in analysis and in Concrete Mathematics (Graham, Knuth, Patashnik). NIST DLMF §1.4 lists ceiling among elementary functions. The computation here is ceil.

How do I calculate the ceiling of a number?

Take the least integer n ≥ x. For 3.2 the result is 4; for −1.2 it is −1. The calculator calls Math.ceil(x) in the browser.

Is ceiling always “away from zero”?

No. Ceiling steps toward +∞ on the number line. For −1.2 the result is −1 (closer to zero), not −2. Away-from-zero for negatives would increase |x| — that is a different rule.

Does ceiling round to 2 decimal places?

No. Here the result is always an integer. Rounding to k decimal places belongs on the round-to-n-places page.

Is this Excel CEILING to a multiple?

No. The input is a single x; the result is ⌈x⌉ with no step or significance. Excel CEILING(number, significance) rounds to a multiple — that model is not used here.

What is ⌈−0.1⌉?

0. The interval is (−1, 0]. Floor of the same x is −1. That is the fifth example on this page.

The result is ⌈x⌉: for x = 3.2 it is 4; for x = −1.2 it is −1 (floor would be −2). Separate floor and round-to-n pages live next door.

Knowledge sources

The definition, ⌈x⌉ notation, and comparison with floor come from recognized sources.

Page updated November 3, 2026.