I knew from my scool, that
1=1(mod 5)
6=1(mod 5)
-1=4(mod 5)
-3=2(mod 5)
and result MUST BE POSITIV !
Why in newlisp
(% -3 5) => -3
and
(mod -2 5) => -2
??
I am sorry - NOT NEGATIVE !
There are various ways to look at this, see http://en.wikipedia.org/wiki/Remainder
newLISP behaves like 'C' or Pascal in this case. '%' and 'mod' in newLISP work like the underlying 'C' library routines: '%=' and 'fmod()'
Lutz
This will always give a non-negative result.
(define (%% m n , result)
(set 'result (% m n))
(+ result (if (< result 0) n 0)))
Or
(define (%% a b) (% (+ (% a b) b) b))
:-)
Very nice, but when running on a 6502 processor clocked at 1.79MHz that extra % will cost you.
Quote
running on a 6502 processor clocked at 1.7
Do you have newLISP running on such a system?
I haven't used my Atari 800XL in ages, but I use my Commodore 64 monitor to watch television; its chroma and luminance inputs accept S-video via a customized cable.
I have also an old C64 standing around in my workplace.
But your post gave the impression, that you run newLISP on a aged hardware. Was this impression wrong?
I was only joking. (If you have a working C64 monitor, try running S-video from a DVD player to its chroma and luminance inputs; the picture is very clear.)