# Floor function

**Topic:** Maths · Mathematical analysis  
**Page:** https://curium.ctopass.com/en/c/partie-entiere  
**Updated:** 2026-09-11

## The three levels

### Beginner — What is the floor of −2.7: −2 or −3?

−3. The floor of a real number x is the greatest integer less than or equal to x, and −3 is indeed the last integer below −2.7. Removing the decimals gives −1, but that is a different operation called truncation, which matches the floor only for positive numbers. For 2.7, both give 2.

### Intermediate — Is the floor of a sum the sum of the floors?

Not always. For 0.6 and 0.7, the floors are 0 and 0, but for 1.3 it is 1. The equality can fall short by one unit, never more: ⌊x⌋ + ⌊y⌋ ≤ ⌊x + y⌋ ≤ ⌊x⌋ + ⌊y⌋ + 1. It is exact whenever one of the two numbers is an integer: ⌊x + n⌋ = ⌊x⌋ + n for every integer n.

### Expert — How does a sum of floors compute a GCD?

Via the formula called Sylvester's or Polezzi's: for a and b positive integers, the sum of ⌊ka/b⌋ for k ranging from 0 to b − 1 equals ((a − 1)(b − 1) + gcd(a, b) − 1)/2. It inverts to gcd(a, b) = a + b − ab + 2 × (that sum). For a = 4 and b = 6, the sum is 0 + 0 + 1 + 2 + 2 + 3 = 8, and 4 + 6 − 24 + 16 indeed gives 2.

## Explore next

- [Decimal number](https://curium.ctopass.com/en/c/nombre-decimal.md)
- [Bolzano-Weierstrass theorem](https://curium.ctopass.com/en/c/theoreme-de-bolzano-weierstrass.md)
- [Rolle's theorem](https://curium.ctopass.com/en/c/theoreme-de-rolle.md)
- [Mean value theorem](https://curium.ctopass.com/en/c/theoreme-des-accroissements-finis.md)
- [Intermediate value theorem](https://curium.ctopass.com/en/c/theoreme-des-valeurs-intermediaires.md)
- [Taylor's theorem](https://curium.ctopass.com/en/c/theoreme-de-taylor.md)
- [Fundamental theorem of calculus](https://curium.ctopass.com/en/c/theoreme-fondamental-de-l-analyse.md)
- [Absolute value](https://curium.ctopass.com/en/c/valeur-absolue.md)
- [Asymptote](https://curium.ctopass.com/en/c/asymptote.md)
- [Supremum](https://curium.ctopass.com/en/c/borne-superieure.md)

---

Curium — Knowledge, one question at a time.

App Store: https://apps.apple.com/fr/app/curium/id6793886587
Google Play: https://play.google.com/store/apps/details?id=com.ctopass.curium
