The Museum of HP Calculators
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.
M01 LBL M M02 x<>y M03 STO i M04 x<>y M05 : M06 LASTx M07 x<>y M08 IP M09 * M10 RCL- i M11 +/- M12 RTN 18 bytes, CHK=72E6
Go back to the software library
Go back to the main exhibit hall