Re: [WP34s] 2 new modulo functions Message #15 Posted by Paul Dale on 27 June 2012, 5:51 p.m., in response to message #14 by Neil Hamilton (Ottawa)
But my version works :-)
Try -16 ENTER -3 XEQ'MOD'
Your version returns -4 which is clearing incorrect.
Mine returns -1 which is.
Mine also sets L correctly and preserves the stack properly.
Inputs RMDR MOD
-16 -3 -1 -1
16 -3 1 -2
-16 3 -1 2
16 3 1 1
You have to add the modulus back in only if the signs of the original numbers are different -- your code doesn't do this.
Still, I'm sure it can be shaved a few instructions.
- Pauli
Edited: 27 June 2012, 5:51 p.m.
|