sum(1,i,a,b) => infinite loop
sum(1,i,1,2) => infinite loop
The reason is that dosum checks whether low+i=high
instead of counting exactly high-low summands. The fix
is simple. Instead of:
\(IF \(EQUAL \*I HI\) \(RETURN U\)\)
\(IF \(= \*HL 0\) \(RETURN U\)\) \(setq \*HL \(1- \*HL\)\)
Remember that *HL is always a fixnum here.
Log in to post a comment.