Are trig tables still quicker

Blitz3D Forums/Blitz3D Programming/Are trig tables still quicker

Well, i ran some tests again:

Delay 1000

Dim cos_(360)
Dim sin_(360)

For loop = 0 To 360

	cos_(loop) = Cos(loop)
	sin_(loop) = Sin(loop)
	
Next

Delay 100

Global timer = MilliSecs()

For loop = 1 To 10000000

	temp = Cos(Rnd(1,360)) * Sin(Rnd(1,360))
	
Next

Print " Real SIN/COS = "+(MilliSecs() - timer)+" Milliseconds"

Delay 100

timer = MilliSecs()

For loop = 1 To 10000000

	temp = cos_(Rand(1,360)) * sin_(Rand(1,350))
	
Next

Print " Lookup SIN/COS = "+(MilliSecs() - timer)+" Milliseconds"

WaitKey()



And my code would definetly agree with you. 10 million iterations of multiplying a random integer COS by a random integer SIN. Then, the same, but this time with lookup tables. Almost twice as fast on this machine.

So apologies for the slightly wrong information :o)