[futurebasic] Re: A Challenge For Someone

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 1998 : Group Archive : Group : All Groups

From: Chris <staz@...>
Date: Tue, 3 Feb 98 10:10:15 -0500
>The small program below, uses the scientific functions of sin and cos
 <snip>

Andy changed this to work in FB II integer functions. 100 iterations on 
my 604e 200 took 77 ticks. The modified program is shown below.

Using integer math, FB II is _very_ fast. While there is not yet an 
equivalent to FB II's USR scientific functions, we were able to recompile 
in FB^3 using floating point calculations. This was not as fast as 
integer math, but showed a marked improvement over FB II's BCD calcs.

6100/60       3 min  8 sec <- my machine
LC-550        2 min 26 sec
7600/120      1 min 55 sec
Quadra-650          57 sec
604e 200            77 ticks (using integer functions) <- the winner
604e 200            83 ticks (using floating point, but recompiled in PPC 
code)

The end result is that PPC math in FB^3 runs at about the same speed as 
integer math in FBII. (I was impressed!)


-STAZ    ~)~

------------------------------------
WIDTH _noTextWrap
WINDOW 1,"Spirograph",(0,0)-(500,400)
TEXT ,,,0
"start"

TwoPI! = 6.283185307
PRINT % (2,21);
INPUT "Number of Pts, < 2 to exit: ";N
CLS
IF N <= 1 THEN STOP

'******* Integer *********
t&=FN TICKCOUNT
H=0
iLoops = (256*100)/N
COLOR _zBlue
FOR x = 0 TO 25500 STEP iLoops
  A = (USR _Sine(x/100)   * 150)/256 + 249
  B = (USR _Cosine(x/100) * 149)/256 + 200
  FOR z = 0 TO 25500 STEP iLoops
    C = (USR _Sine(z/100)   * 150)/256 + 249
    D = (USR _Cosine(z/100) * 149)/256 + 200
    PLOT A,B TO C,D
    IF FN BUTTON STOP
  NEXT
  H=H+1 : PRINT % (360,21) H
NEXT

t&=FN TICKCOUNT-t&
PRINT % (400,21) t&;" ticks";

'******* Float *********
t&=FN TICKCOUNT
H=0
COLOR _zRed
loops! = TwoPI!/N
FOR X! = 0 TO TwoPI! STEP loops!
  A = SIN (X!) * 150 + 249
  B = COS (X!) * 149 + 200
  FOR Z! = 0 TO TwoPI! STEP loops!
    C = SIN (Z!) * 150 + 249
    D = COS (Z!) * 149 + 200
    PLOT A,B TO C,D
    IF FN BUTTON STOP
  NEXT Z!
  H=H+1 : PRINT % (360,36) H
NEXT X!
COLOR _zBlack

t&=FN TICKCOUNT-t&

PRINT % (400,36) t&;" ticks";

GOTO "start"


Pizza, Pizza,

-STAZ   ~)~

--------------------------------------------------------------
STAZ Software * 4387 Leisure Time Dr * Diamondhead, MS 39525
--------------------------------------------------------------
Orders: 800-348-2623      EMail http: //www.stazsoftware.com
  Tech: 601-255-7085             FAX: 601-255-7086     
--------------------------------------------------------------