Mod function
03-13-2016, 08:29 AM
Post: #1
 ggauny@live.fr Senior Member Posts: 528 Joined: Nov 2014
Mod function
Hi,
Because I studyie programs of goods programmers in the library wp34s at southforge, I have see by fortuitousely that a little routine is to MOD operation HP41/
HP42.

Then I remembered of old one for HP32s(ii), from P. Fellerich in 2002. I had tryed
put it in the library but I cannot do. Then I give you :

Code:
 LBL'MOD' x<>y STO I x<>y / RCL L x<>y IP * RCL- I +/- END

Commentaries was :
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.

Have a good sunday.

Gérard.
03-13-2016, 01:26 PM
Post: #2
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: Mod function
(03-13-2016 08:29 AM)ggauny@live.fr Wrote:  Then I remembered of old one for HP32s(ii), from P. Fellerich in 2002. I had tryed
put it in the library but I cannot do. Then I give you :

If I understand you correctly, this is a MOD routine for the 34s.
But.... did you notice that the 34s offers both a built-in MOD and a RMDR function ?-)

However, I'm not sure if I correctly understand your intention.

Dieter
03-13-2016, 03:56 PM
Post: #3
 Katie Wasserman Super Moderator Posts: 631 Joined: Dec 2013
RE: Mod function
For MOD on the 32sii take a look at this old thread.

-katie

03-14-2016, 11:02 AM
Post: #4
 ggauny@live.fr Senior Member Posts: 528 Joined: Nov 2014
RE: Mod function
Hi Dieter,

Yes I know Theses functions exists, and in my head I have your DIVMODE routine, it was only because a similare routine is in library that I give this here.

I remerciat Katie for me write.

Nice day for you all.

Gérard.
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)