Changeset 2995
 Timestamp:
 Jun 1, 2012, 8:31:33 PM (23 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

forth/lib/isin.fth
r2994 r2995 28 28 2/ to #cycle/4 29 29 ; 30 : u*/ ( u1 unum udenom  u2 ) >r um* r> um/mod nip ; 30 31 : setperiod ( cycle/4  ) 31 32 dup to #cycle/4 ( cycle/4 ) … … 33 34 2* dup to #cycle ( cycle ) 34 35 fs over / to freq ( period ) 35 pi swap / fs *to fstep ( )36 pi fs rot u*/ to fstep ( ) 36 37 ; 37 38 38 39 \ Multiply two fractional numbers where the scale factor is 2^15 39 \ : times ( n1 n2  n3 ) d# 32767 */ ; \ Insignificantly more accurate, but slower 40 : times ( n1 n2  n3 ) * d# 15 rshift ; 40 : times ( n1 n2  n3 ) d# 32767 u*/ ; 41 41 42 42 \ Computes (1  (theta^2 / divisor) * last) … … 49 49 50 50 : icos ( index  frac ) 51 fstep fs 2/ */ to theta51 fstep fs 2/ u*/ to theta 52 52 theta dup times to thetasq 53 53 one d# 90 cosstep d# 56 cosstep d# 30 cosstep d# 12 cosstep 2 cosstep one min … … 60 60 \ This is good for the first quadrant only, i.e. 0 <= index <= fs / freq / 4 61 61 : calcsin ( index  frac ) 62 fstep fs 2/ */ to theta62 fstep fs 2/ u*/ to theta 63 63 theta dup times to thetasq 64 64 one d# 72 sinstep d# 42 sinstep d# 20 sinstep 6 sinstep theta times one min
Note: See TracChangeset
for help on using the changeset viewer.