Skip to content
Property Value
Hex Value $B1
Categories
Localizations
  • FR: partEnt(

int(

Overview

Returns the largest integer ≤ a real or complex number, expression, list, or matrix.

Availability: Token available everywhere.

Syntax

int(value)

Arguments

NameTypeOptional
value

Location

math, NUM, 5:int(


Description

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

int(5.32)
               5
int(4/5)
               0
int(‾5.32)
               ‾6
int(‾4/5)
               ‾1

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 fractional 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 use int( because it is shorter; some use iPart( when there is a corresponding fPart( taken. However, if speed is a consideration, one should check 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: int( scales with the length of its input while iPart( does not. For fewer than 6 decimals, int( will most often be faster; for 6 or more decimals, consider using iPart(.

See Also


Source: parts of this page were written by the following TI|BD contributors: burr, CloudVariable, DarkerLine, GoVegan, kg583, Timtech.

History

Calculator OS Version Description
TI-82 1.0 int added
TI-83 0.01013 Renamed int to int(
Authors: Adrien Bertrand