Floor in LaTeX (\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: Number Theory, Computer Science
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\begin{document}
Floor: $\lfloor x \rfloor$
\[ x - 1 < \lfloor x \rfloor \le x \]
\end{document}Related symbols
- Double Vertical Bar
\| - Floor Right
\rfloor - Norm
\| x \| - Floor Left
\lfloor - Double Bracket Left
\llbracket - Ceiling
\lceil x \rceil
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.
Pinakamahusay na AI LaTeX Editor, Alternatibo sa Overleaf
Tinutulungan ng Octree ang mga researcher mula sa 15+ na unibersidad na sumulat ng research papers nang mas mabilis gamit ang AI
- Gumawa ng magagandang TikZ diagrams gamit ang AI
- Mag-upload ng larawan at i-convert ito sa LaTeX nang walang problema
- Makakuha ng instant na tulong sa pagsulat at pag-format ng research papers