From Learn @ Cemetech
Jump to navigationJump to search


Command Summary

Rounds a value down to the nearest integer.

Command Syntax


Menu Location


  1. MATH to access the Math menu.
  2. RIGHT to access the NUM submenu.
  3. 5 to select int(, or use arrows.

Calculator Compatibility


Token Size

1 byte

int(value) is the floor function. It returns the greatest integer less than or equal to value. Also works on complex numbers, lists and matrices.


The difference between IPart( and int( is subtle, and many people aren't even aware of it, but it exists. Whereas iPart( always truncates its parameters, simply removing the integer part, int( always rounds down. This means that they return the same answers for positive numbers, but int( will return an answer 1 less than iPart( for (non-integer) negative numbers. For example, iPart(-5.32) is -5, while int(-5.32) is -6.

Most of the time, however, you're dealing with only positive numbers anyway. In this case, the decision to use iPart( or int( is mostly a matter of preference - some people only use int( because it is shorter, some people use iPart( when there is a corresponding FPart( taken. However, see the Command Timings section.

Advanced Uses

int(, along with IPart( and FPart(, can be used for integer Compression.

Command Timings

The following table compares the speeds of int and IPart(. Each command was timed over 2000 iterations to find a noticeable difference.

Format Bars Pixels Total
iPart(1 10 1 81
iPart(1.643759 10 1 81
int(1 8 7 71
int(1.643759 10 2 82

Conclusion: Unless there are 6 or more decimals, you should consider using int( because of its speed, but with a lot of decimals, iPart( stays the same so it goes faster.

Related Commands

See Also