Math Fundamentals18 sections · 814 units
Open in Course

Vocabulary - Floor

Rounding down

The floor function x\lfloor x \rfloor rounds xx down to the nearest integer. For example, 7.9=7\lfloor 7.9 \rfloor = 7 and 2.3=3\lfloor -2.3 \rfloor = -3 (down means toward negative infinity).

Integer division is floor division for positive numbers. When you compute 7/3\lfloor 7 / 3 \rfloor, you get 22, the same as integer division.

Watch out for negative numbers. 7/3=2.333...=3\lfloor -7 / 3 \rfloor = \lfloor -2.333... \rfloor = -3, not 2-2. Different languages handle this differently, so check the documentation.