
#include <FREQOUT.bas>
FUNCTION COS ( expression ) ' declared in FREQOUT.bas
ARMbasic uses integers, but there may be a need
for certain functions that normally use floating point calculations. One
of these is the cosine function, which normally operates on degrees or
radians. But for simplicity and the binary world, these values and the
result value have been normalized to fit in a byte value. So rather than taking
an argument of 0..359 or 0..2 p
, the argument is 0-255
which is equal to the number of degrees times 0.7103 (256/360). The
result would normally be between -1 and 1, but in this case it is expressed as -127
to +127 or the cos() multiplied by 127.