Tuesday, March 3, 2015

Casio Prizm and TI-84+: Modulus Program

Casio Prizm and TI-84+: Modulus Program
 
Formula:
A MOD B = B * frac(A/B) + B * (A<0 and B>0) + B * (B<0 and A>0)
(updated 1/6/2016)

Remove the prompt of A and B to make MODDIV suitable as a subroutine.

Casio Prizm: MODDIV (including fx-9860g & fx-9750g)
"A"? → A
"B" → B
B × Frac (A ÷ B) + B × (A < 0 And B > 0) + B × (B < 0 And A > 0)


TI-84: MODDIV
Prompt A, B
B * fPart(A/B) + B * (A<0 and B>0) + B * (B<0 and A>0)


Examples:

A mod B = R

A = 48, B = 3, R = 0
A = -52, B = 6, R = 2
A = 41.3, B = 12, R = 5.3
A = -50.2, B = 36, R = 21.8
A = 48, B = -7, R = -1

This blog is property of Edward Shore. 2015