Plan 9 from Bell Labs’s /usr/web/sources/contrib/fgb/root/sys/src/cmd/4th/lib/asinacos.4th

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


\ 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]
  

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.