The floor() Command

floor.png

Command Summary

Returns the floor of a number.

Command Syntax

floor(value)

Menu Location

  • Press 2nd MATH to enter the MATH popup menu.
  • Press 1 to enter the Number submenu.
  • Press 6 to select floor(.

Calculator Compatibility

This command works on all calculators.

Token Size

1 byte

The floor() command rounds a number down to the nearest integer less than or equal to the number. For instance, floor(π) returns 3, while floor(-π) returns -4.

The command is an alias for int(): they do the exact same thing. The calculator prefers using floor() (in fact, int() will be converted to floor() in symbolic expressions); int() is left over from earlier calculator models. Other rounding commands include:

  • ceiling() — like floor(), but always rounds up (to the next higher integer).
  • iPart() — truncates a number to just its integer part (or, if you prefer, rounds a number toward 0).
  • round() — rounds to a specific place value, not just to an integer, but round(x,0) will round x to the nearest integer, up or down.

floor() can also be applied to complex numbers, lists, and matrices, rounding everything that there is to round in each of them.

:floor(3)
           3
:floor({-π,π})
           {-4  3}

Related Commands

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Noncommercial 2.5 License.