Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
doc; update fSin function
Browse files Browse the repository at this point in the history
  • Loading branch information
boriel committed Oct 16, 2022
1 parent cde5efb commit cb9e632
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions docs/library/fsin.bas.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,17 @@ FUNCTION fSin(num as FIXED) as FIXED
DIM quad as byte
DIM est1,dif as uByte
num = num MOD 360
'This change made now that MOD works with FIXED types.
'This is much faster than the repeated subtraction method for large angles (much > 360)
'This is much faster than the repeated subtraction method for large angles (much > 360)
'while having some tiny rounding errors that should not significantly affect our results.
'Note that the result may be positive or negative still, and for SIN(360) might come out
'fractionally above 360 (which would cause issued) so the below code still is required.
while num>=360
num=num-360
end while
while num<0
num=num+360
end while
IF num >= 360 THEN
num = num MOD360
ELSEIF num < 0 THEN
num = 360 - ABS(num) MOD 360
END IF
IF num>180 then
quad=-1
Expand Down Expand Up @@ -63,7 +60,7 @@ sinetable:
asm
DEFB 000,009,018,027,035,044,053,062
DEFB 070,079,087,096,104,112,120,127
DEFB 135,143,150,157,164,171,177,183
DEFB 135,143,150,157,164,171,177,183
DEFB 190,195,201,206,211,216,221,225
DEFB 229,233,236,240,243,245,247,249
DEFB 251,253,254,254,255,255
Expand All @@ -86,4 +83,3 @@ FUNCTION fTan(num as FIXED) as FIXED
return fSin(num)/fSin(90-num)
END FUNCTION
```

0 comments on commit cb9e632

Please sign in to comment.