Returns the integer part of a value.
iPart(value)
Press:
- MATH to access the math menu.
- RIGHT to access the NUM submenu
- 3 to select iPart(, or use arrows.
TI-83/84/+/SE/CE
1 byte
iPart(value) returns the integer part of value, and extends to complex numbers, lists, and matrices.
iPart(5.32)
5
iPart(4/5)
0
iPart(‾5.32)
‾5
iPart(‾4/5)
0
The difference between iPart( and int( is subtle; while 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.
In this case of positive values, though, 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
iPart(, along with fPart( and int(, 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: With 5 or fewer decimal places, you should consider using int( because of its speed, but with more decimals, iPart( remains constant to eventually beat out its counterpart.
Related Commands
See Also
.