The Museum of HP Calculators

MOD (modulo) operation for the 32S(II)

This program is Copyright © 2002 by Pascal Fellerich and is used here by permission.

This program is supplied without representation or warranty of any kind. Pascal Fellerich and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.


Returns the remainder of Y divided by X. The program may seem large for what it does, but it works like a built-in function in that respect that it does not modify stack levels Z and T. Based on the expression Y MOD X = Y - X * IP(Y / X), it doesn't degrade for large Y. It uses i as intermedate storage for Y. LASTx contains the result of the subexpression X*IP(Y/X) afterwards.


M02 x<>y
M03 STO i
M04 x<>y
M05 :
M07 x<>y
M08 IP
M09 *
M10 RCL- i
M11 +/-
18 bytes, CHK=72E6

Go back to the software library
Go back to the main exhibit hall