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

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


\ 4tH library - FERF - Copyright 2009 J.L. Bezemer
\ You can redistribute this file and/or modify it under
\ the terms of the GNU General Public License
\ include lib/ansfloat.4th

[UNDEFINED] ferf    [IF]
[UNDEFINED] pi      [IF] include lib/fpconst.4th [THEN]
[UNDEFINED] >taylor [IF] include lib/taylor.4th  [THEN]
: ferf
  fdup f0< fdup fabs s" 1.86" s>float f<
  if drop else fdrop 1 s>f if fnegate then exit then
  fdup >taylor
          3 -taylor
         10 +taylor
         42 -taylor
        216 +taylor
       1320 -taylor
       9360 +taylor
      75600 -taylor
     685440 +taylor
    6894720 -taylor
   76204800 +taylor
  918086400 -taylor
  fdrop fdrop
  2 s>f pi fsqrt f/ f*
;
[THEN]

\ : ferf-test
\  fclear 10 set-precision
\  -2 s>f begin
\    fdup 2 s>f F< 
\  while
\    fdup fdup f. ferf f. cr
\    s" 0.05" s>float f+
\  repeat fdrop fdepth . depth .
\ ; ferf-test

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].