Re: Eu 2.3 trace BUG!

new topic     » goto parent     » topic index » view thread      » older message » newer message

On 11 Apr 2002, at 21:18, akusaya at gmx.net wrote:

> 
> This is my code:
> 
> ------------------ start ------------
> 
> function cekPrima(sequence bilPrima, atom cekangka)
> atom isilist
> 
>         for j=1 to length(bilPrima) do
>             isilist=bilPrima[j]
>             if (cekangka/isilist - floor(cekangka/isilist))=0 then
>                 --bukan bil prima
>                 return 0
>             else
>                 --bilprima
>                 if power(isilist,2)>cekangka then
>                     return 1
>                 end if
>             end if
>         end for
> 
>         return 1
> 
> end function
> 
> sequence p
> p = {2, 3}
> 
> for i = 3 to 10000 by 2 do
>     if cekPrima(p, i)=1 then
>         p &= i
>     end if                   
> end for 
> 
> ? p
> 
> integer pos
> integer jum
> 
> with trace
> trace(1)
> 
> for i=2 to 100000000 do
>         pos = 1
>         jum = 1
> 
>         while 1 do
>                 if p[pos] > sqrt(i) then
>                         exit
>                 elsif p[pos] = sqrt(i) then
>                         jum += p[pos]
>                 else
>                         pos += 1
>                         if integer( i/p[pos] ) then
>                                 jum += i/p[pos] + p[pos]
>                         end if
>                 end if
>         end while
> 
>         if jum = i then
>                 ? i
>         end if
> end for
> 
> ------------------------- end ----------------
> 
> Execute, and it will bring a trace window.
> 
> Highlighted: for i=2 to 100000000 do
> 
> Press DOWN. (don't press ENTER)

Press ENTER. (Don't press DOWN)

> Press ?i
> 
> "i=9999" is displayed on left side??? it should be 2.

No, because the display will not update if you do not press ENTER. The i 
was 9999 from lines before.

> Press ENTER many times until "end for"
> 
> Press ENTER one time more.
> 
> "i=9999" in the left disappears, "i=3" appears in right side.

Because you pressed ENTER.
 
> Press ?i
> 
> "i=3" in the right disappears, "i=9999" appears again in left side.
> 
> 
> Is this really a bug?!

No. You should press ENTER.

Kat

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu