Modulo, Binary & Hexadecimal on a TI-89
The TI-89 has a full set of integer tools:
mod(andremain(for remainders, withgcd(andlcm(, all in 2ND 5 (MATH) → Number,►Bin,►Hexand►Decfor base conversions, in MATH → Base,- a Base mode setting that shows integer results in DEC, HEX or BIN.
These steps are for the TI-89 / TI-89 Titanium handheld, from Texas Instruments' guidebook. Our online TI-89 calculator runs PedroM, a free third-party operating system and doesn't support every handheld feature, so check what it offers before following along there.
mod and remain
| Entry | Result | Notes |
|---|---|---|
mod(17,5) |
2 | |
mod(-7,3) |
2 | the result has the sign of the divisor (Texas Instruments' example) |
remain(-7,3) |
−1 | the result has the sign of the dividend |
gcd(18,33) |
3 | |
lcm(6,9) |
18 |
For positive numbers mod( and remain( agree. They only differ when a number is negative. In maths and most programming languages' modulo, mod( is the one you want.
Clock arithmetic: what time is it 50 hours after 9:00? mod(9+50,24) → 11, so 11:00.
Convert between bases
Enter binary numbers with the prefix 0b and hexadecimal with 0h. A number without a prefix is decimal.
| Entry | Result |
|---|---|
256 ►Hex |
0h100 |
0b10011 ►Dec |
19 |
0h1F ►Bin |
0b11111 |
255 ►Bin |
0b11111111 |
►Bin always shows binary, whatever the Base mode. Binary entries can have up to 32 digits and hex entries up to 8.
Base mode
MODE → Base sets how integer results are displayed: DEC (normal), HEX or BIN. With Base set to HEX, 0h1F+1 gives 0h20. Set it back to DEC for ordinary maths. Some apps need it to be DEC.
Two's complement
In Base mode, the TI-89 treats integers as signed 32-bit numbers, so negative numbers appear in two's complement form. In BIN mode, −5 shows as thirty-two digits ending in 11111011: the 1s on the left are the sign extension.
To find the two's complement of a value by hand, flip the bits with not and add 1. Use parentheses so not applies before the addition:
(not 0b101)+1 → the 32-bit two's complement of 5, which is −5
For an 8-bit answer, mask off the low 8 bits with and:
((not 5)+1) and 0hFF ►Bin → 0b11111011
Decimal numbers too large for 32 bits are wrapped into range, so don't use Base mode for big-integer arithmetic. For that, stay in DEC, where the TI-89 handles very large exact integers.
Shifts and rotations
rotate(integer, n) (in MATH → Base) and shift(integer, n) (in CATALOG) move bits left (n > 0) or right (n < 0). For bitwise and, or, xor and not, see Boolean algebra.
Common problems
| Problem | Fix |
|---|---|
Results show as 0h… |
Base mode is HEX. Set MODE → Base → DEC |
mod( result is negative or unexpected |
check which argument is the divisor: mod(dividend, divisor) |
| Base conversion error | the value must be an integer |
| Huge numbers wrap around | Base mode uses 32-bit integers. Switch to DEC |
Related tutorials
Review note: the handheld keystrokes on this page come from Texas Instruments' TI-89 Titanium guidebook and knowledge base. They have not yet been checked on a physical calculator.