The intDiv() Command

We're glad you came by, but you might find what you're looking for elsewhere.

TI-Basic Developer is not the site it once was. While its information on commands and other calculator features remains almost second-to-none, its forum, archives, and even hosting service, Wikidot, have been decaying for years. The calculator community would love to see what you're working on, or help you in your next coding adventure, but TI-Basic Developer is no longer the place to do it.

Instead, you should head over to Cemetech (primarily American) or TI-Planet (primarily international). Both are active, well-established forums with their own archives, chatrooms, reference material, and abundant coding tools and resources. We'll see you there, we hope.

intdiv.png

Command Summary

Returns the whole number part of a division.

Command Syntax

intDiv(dividend,divisor)

Menu Location

This command can't be found in any menu besides the command catalog.

Calculator Compatibility

This command works on all calculators.

Token Size

1 byte

The integer division command, intDiv(a,b) returns the whole number portion of a/b: this is equal to iPart(a/b). Although this operation is most useful for dividing whole numbers, this definition works for any number, whole or decimal, real or complex.

:intDiv(125,3)
           41
:intDiv(-125,3)
           -41
:intDiv(125,π)
           39

Advanced Uses

The intDiv() command also works for lists and matrices. Used with a list or matrix and a number, intDiv() is applied to the number paired with every element of the list or matrix. Used with two lists or two matrices, which must match in size, intDiv() is applied to matching elements of the list or matrix.


Use intDiv() and remain() for the quotient and remainder results of long division, respectively.

Optimization

Constructions like iPart(a/b) should be replaced with intDiv(a,b): this is smaller and faster.

Error Conditions

240 - Dimension mismatch happens when two list or matrix arguments don't match in size.

Division by zero does not throw an error; an undefined value is returned instead.

Related Commands

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