#460 sum doesn't terminate sometimes/FIX

closed
nobody
None
4
2004-11-23
2003-12-04
No

tellsimpafter(b-a,1);
sum(1,i,a,b) => infinite loop

simp:false;
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\)\)

use

\(IF \(= \*HL 0\) \(RETURN U\)\)
\(setq \*HL \(1- \*HL\)\)

Remember that *HL is always a fixnum here.

Discussion

  • Raymond Toy

    Raymond Toy - 2003-12-06

    Logged In: YES
    user_id=28849

    Fix applied. But I didn't have a problem with the second
    example.

     
  • Raymond Toy

    Raymond Toy - 2004-11-23

    Logged In: YES
    user_id=28849

    Suggested fix actually applied.

     
  • Raymond Toy

    Raymond Toy - 2004-11-23
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks