# Fixed Point Maths

## version 5 by Michael Callaghan

Section 6 - Sines

To decide what real number is the sine of (N - a real number):
while N is negative:
let N be N real plus 360.0000;
while N is real greater than 360.0000:
let N be N real minus 360.0000;
if N real equals 0.0000:
decide on 0.0000;
if N real equals 90.0000:
decide on 1.0000;
if N real equals 180.0000:
decide on 0.0000;
if N real equals 270.0000:
decide on -1.0000;
if N real equals 360.0000:
decide on 0.0000;
if N is real greater than 180.0000:
let N be N real minus 180.0000;
if N is real greater than 90.0000:
let N be 180.0000 - N;
let temp be N in radians;
let result be temp;
let sign be -1;
repeat with X running from 3 to 7:
let temp1 be temp to the power X;
let temp2 be the factorial of X;
let temp3 be temp2 as a fixed point number;
let temp1 be temp1 real divided by temp3;
if sign is -1:
let result be result real minus temp1;
let sign be the reverse of sign;
otherwise:
let result be result real plus temp1;
let sign be the reverse of sign;
increase x by 1;
let result be the reverse of result;
decide on result.

To decide what real number is the sine of (N - a number):
let temp be N as a fixed point number;
decide on the sine of temp.

To decide what real number is the arcsine of (N - a real number):
if N real equals 0.0000:
decide on 0.0000;
if N real equals -1:
decide on -90.0000;
if N real equals 1:
decide on 90.0000;
let temp be the absolute value of N;
if temp is real greater than 1.0000:
decide on 0.0000;
let temp1 be 1 real minus N;
let temp1 be the real square root of temp1;
let temp2 be 1.5707;
let temp3 be -0.2121 real times N;
let temp2 be temp2 plus temp3;
let temp3 be N to the power 2;
let temp3 be temp3 real times 0.0743;
let temp2 be temp2 real plus temp3;
let temp3 be N to the power 3;
let temp3 be temp3 real times 0.0187;
let temp2 be temp2 real minus temp3;
let temp1 be temp1 real times temp2;
let temp1 be 1.5708 real minus temp1;
decide on temp1 in degrees.