HP Forums
Mod function - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not quite HP Calculators - but related (/forum-8.html)
+--- Thread: Mod function (/thread-5865.html)



Mod function - ggauny@live.fr - 03-13-2016 08:29 AM

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.


RE: Mod function - Dieter - 03-13-2016 01:26 PM

(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


RE: Mod function - Katie Wasserman - 03-13-2016 03:56 PM

For MOD on the 32sii take a look at this old thread.


RE: Mod function - ggauny@live.fr - 03-14-2016 11:02 AM

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.