Floor in LaTeX (\lfloor x \rfloor)

⌊x⌋\lfloor x \rfloor
LaTeX command
\lfloor x \rfloor
Package
No package needed: built into LaTeX
Mode
Math mode only

Where it is used

Rounds x down to the greatest integer less than or equal to it: the floor function.

The floor appears in integer division, in the fractional part \{x\} = x - \lfloor x \rfloor, in the binary search midpoint \lfloor (lo + hi)/2 \rfloor, and in number theory sums like Legendre's formula. For negative numbers it rounds away from zero: \lfloor -2.5 \rfloor = -3, which differs from truncation. Older literature wrote [x] for the floor (the Gauss bracket), but the bracket notation is now preferred because it is unambiguous. Use \left\lfloor ... \right\rfloor around fractions so the brackets match the content height.

Also listed under: نظرية الأعداد, علوم الحاسوب

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

x−1<⌊x⌋≤xx - 1 < \lfloor x \rfloor \le x
\documentclass{article}
\begin{document}
Floor: $\lfloor x \rfloor$

\[ x - 1 < \lfloor x \rfloor \le x \]
\end{document}

Related symbols

All الأقواس والمحددات →

Frequently asked questions

How do I write Floor in LaTeX?
Type \lfloor x \rfloor in math mode, for example $x - 1 < \lfloor x \rfloor \le x$. It works in plain LaTeX without loading any package.
Which package do I need for \lfloor x \rfloor?
None. \lfloor x \rfloor is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use \lfloor x \rfloor in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\lfloor x \rfloor$ in running text.
Math poweredاكتب LaTeX باستخدام الذكاء الاصطناعي

أفضل محرر LaTeX بالذكاء الاصطناعي، بديل Overleaf

يساعد Octree الباحثين من أكثر من 15 جامعة على كتابة أوراق البحث بشكل أسرع باستخدام الذكاء الاصطناعي

  • أنشئ رسوم TikZ جميلة باستخدام الذكاء الاصطناعي
  • ارفع صورة وحولها إلى LaTeX بسلاسة
  • احصل على مساعدة فورية في كتابة وتنسيق أوراق البحث