@Dreamora: Actually I did try float. It was marginally slower than Doubles. When using the ^ opperator, the arguments are passed to the function double bbFloatPow( double x,double y ) in blitz_cclib.c. There isn't a Float nor an Int version. Anything you use will be converted to double, including Floats.
Now I tried doing b^(3:Float) and b^(3:double) and didn't see any change.
The fact is, ^ is still significantly slower than *.
Here's a real world example.
Press ENTER to toggle from using ^ to using * Notice a huge jump? On my machine it went from 53 fps to 200 fps. Makes a huge difference, and this was just checking the distance between 200 objects.
Now I tried doing b^(3:Float) and b^(3:double) and didn't see any change.
The fact is, ^ is still significantly slower than *.
Here's a real world example.
Strict Type TSprite Field x Field y End Type Local Sprites:TSprite[200] For Local t:Int = 0 To 199 Sprites[t] = New TSprite Sprites[t].x = Rand(0,1023) Sprites[t].y = Rand(0,767) Next Graphics 1024,768,32 Local Frames:Int = 0 Local FPS:Int = 0 Local Power:Int = True Local Distance:Float Local Time:Int = MilliSecs() While Not KeyHit(KEY_ESCAPE) Cls If KeyHit(KEY_ENTER) Then Power = Not Power For Local t:Int = 0 To 198 SetColor 255,255,255 For Local u:Int = t+1 To 199 If Power Distance = Sqr((Sprites[t].x-Sprites[u].x)^2+(Sprites[t].y-Sprites[u].y)^2) Else Distance = Sqr((Sprites[t].x-Sprites[u].x)*(Sprites[t].x-Sprites[u].x)+.. (Sprites[t].y-Sprites[u].y)*(Sprites[t].y-Sprites[u].y)) End If If Distance < 50 Then SetColor 255,255,0 Next DrawOval Sprites[t].x-5,Sprites[t].y-5,10,10 Next SetColor 255,255,255 DrawRect 9,9,100,30 SetColor 0,0,255 If Power DrawText "Sqr(x^2+y^2)",10,10 Else DrawText "Sqr(x*x+y*y)",10,10 End If DrawText FPS,10,20 Flip 0 If MilliSecs() - Time >= 1000 FPS = Frames Frames = 0 Time = MilliSecs() End If Frames :+ 1 Wend
Press ENTER to toggle from using ^ to using * Notice a huge jump? On my machine it went from 53 fps to 200 fps. Makes a huge difference, and this was just checking the distance between 200 objects.