← TechnologyThe essentials of

Math.floor(): down means to minus infinity

Publisher: ResumeMaker • 1 source

Published: 22 Oct 2026 13:13 · Updated: 22 Oct 2026 13:13

AI source check: 21 Oct 2026 12:40. This is not editorial approval.

In a few sentences

In brief

Cutting the fractional part is a different operation for negative numbers.

Useful to know

Math.floor() returns the largest integer that is not greater than the input. Math.floor(2.8) is 2, but Math.floor(-2.8) is -3. [1]

This is convenient when dividing values at intervals, when looking for the lower mathematical limit. Don't just call it "waiving the decimal": for negative numbers, this would give another result. If the range in the application includes both directions around zero, check the boundary examples before using floor for cell or group numbers.

Sources

For further detail and to check the information:

  1. [1] MDN — Math.floor ↗