FSin.bas
Introduction
This function implements fast Fixed point sin, cos and tan functions.
The ones that uses Float type (calling the Sinclair ROM) are much slower as FP Calculations
are expensive. This variant is less precise but more suitable for games, for example.
fSin is the basis for the alternatives, since COS(x) can be calculated
from SIN(x) and TAN(x) as SIN(x) / COS(x).
Note
This library is already bundled with Boriel BASIC.
To use it just add #include <fmath.bas>
at the beginning of your program.
The functions should be accurate to about 0.25%, and significantly faster.
If you need a lot of trig in your code, and it doesn't need to be pinpoint accuracy, these are good alternatives.
Note that they more or less acknowledge they are less accurate by returning values of type Fixed instead
of type Float.
It should be fine for the actual accuracy returned,
and Fixed numbers process faster and smaller than Float ones.
-
Note that you need only include
fSinif you only want Sines, but you needfSinto usefCosorfTan. -
Note that these functions use degrees, not radians.