Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not so much a bug, as slow!
#1
This program was posted on the WOS forums:

Code:
For x=-100 To 100
For y=-100 To 100
If (x/2-25)*(x/2-25)+(y-50)*(y-50)<200 Or (x/2+25)*(x/2+25)+(y-50)*(y-50)<200 then plot x+100,96-y
Next y
Next x

And if run as is, takes about 9 seconds in Basic, I think.

As ZX Basic:

Code:
FUNCTION t() as uLong
asm
    DI
    LD DE,(23674)
    LD D,0
    LD HL,(23672)
    EI
end asm
end function

DIM x,y as integer
DIM time as uLONG

time=t()

For x=-100 To 100
For y=-100 To 100
If (x/2-25)*(x/2-25)+(y-50)*(y-50)<200 Or (x/2+25)*(x/2+25)+(y-50)*(y-50)<200 then plot x+100,96-y
END IF
Next y
Next x  

time=t()-time
print CAST(float,time)/50

It takes 53 seconds!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)