\ 4tH library - FASIN FACOS FATAN - Copyright 2008,2009 J.L. Bezemer
\ You can redistribute this file and/or modify it under
\ the terms of the GNU General Public License
[UNDEFINED] fasin [IF]
[UNDEFINED] pi [IF] include lib/fpconst.4th [THEN]
[UNDEFINED] +taylor [IF] include lib/taylor.4th [THEN]
: 2degrees 1+ 1+ dup -taylor 1+ 1+ dup +taylor ;
: (taylor) 1 2degrees 2degrees 2degrees 2degrees 2degrees drop fdrop fdrop ;
: >range 1 s>f fover fdup f* fover f+ fsqrt f+ f/ ;
: (fatan) fdup >taylor (taylor) ;
: range? f< if >range (fatan) fdup f+ else (fatan) then ;
: fatan 3 s>f 4 s>f f/ fover fabs range? ;
: (fasin) 1 s>f fover fdup f* fover fswap f- fsqrt f+ f/ fatan fdup f+ ;
: fasin fdup fabs 1 s>f f= if pi 2 s>f f/ f* else (fasin) then ;
: facos fasin pi 2 s>f f/ fswap f- ;
[DEFINED] 4TH# [IF]
hide 2degrees
hide (taylor)
hide (fatan)
hide (fasin)
hide >range
hide range?
[THEN]
[THEN]
|