fix trig bug

This commit is contained in:
~d6 2023-11-05 21:03:21 -05:00
parent 2fe1d7d770
commit 3993dbc80a
1 changed files with 1 additions and 5 deletions

View File

@ -343,12 +343,9 @@
POP2r POP2r NIP2 JMP2r ( s1* ) POP2r POP2r NIP2 JMP2r ( s1* )
@x16-cos ( x* -> cos[x]* ) @x16-cos ( x* -> cos[x]* )
x16-pi/2 ,&x16-sin-cos-helper/offset STR2 !sin-cos-helper x16-pi/2 ADD2
@x16-sin ( x* -> sin[x]* ) @x16-sin ( x* -> sin[x]* )
#0000 ,&x16-sin-cos-helper/offset STR2 ( fall-through )
@x16-sin-cos-helper
DUP2 #8000 LTH2 ?&non-negative DUP2 #8000 LTH2 ?&non-negative
x16-negate x16-sin/non-negative !x16-negate x16-negate x16-sin/non-negative !x16-negate
&non-negative &non-negative
@ -356,7 +353,6 @@
DUP2 STH2kr x16-quotient ( x x/2pi [2pi] ) DUP2 STH2kr x16-quotient ( x x/2pi [2pi] )
DUP2 #1400 DIV2 STH2 SWP2r ( x x/2pi [adj* 2pi*] ) DUP2 #1400 DIV2 STH2 SWP2r ( x x/2pi [adj* 2pi*] )
STH2r x16-mul STH2r ADD2 SUB2 ( x' ; 0 <= x' < 2pi ) STH2r x16-mul STH2r ADD2 SUB2 ( x' ; 0 <= x' < 2pi )
LIT2 [ &offset $2 ] ADD2
DUP2 x16-3pi/2 LTH2 ?&c1 DUP2 x16-3pi/2 LTH2 ?&c1
( -sin(2pi - x) ) x16-pi*2 SWP2 SUB2 x16-sin-q !x16-negate ( -sin(2pi - x) ) x16-pi*2 SWP2 SUB2 x16-sin-q !x16-negate
&c1 DUP2 x16-pi LTH2 ?&c2 &c1 DUP2 x16-pi LTH2 ?&c2