home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Yerk 3.6.6 / Float source / fpExtra < prev    next >
Encoding:
Text File  |  1993-05-08  |  1.6 KB  |  45 lines  |  [TEXT/YERK]

  1.    Zero-equal-to logical operator for floats
  2. : f0=       0.0 f= ;
  3.  
  4. ( -- bool )
  5. \ ( x -F- )         Zero-Less-than logical operator for floats
  6. : f0<       0.0 f< ;
  7.  
  8. ( -- bool )
  9. \ ( x -F- )         Zero-greater-than logical operator for floats
  10. : f0>       0.0 f> ;
  11.  
  12. \ ===================================================================== \
  13.  
  14. : 1/x   1.0 swap f/  ;
  15.  
  16. \ ( x -- log(x) )     log base 10 of x
  17. : log       ln ln(10) f/    ;
  18.  
  19. \ ( x -- antilog(x) ) antilog ( 10^x ) of x
  20. : antilog   ln(10) f* exp   ;
  21.  
  22. \ ( x -- cot(x) ) cotangent of x
  23. : cot       tan 1/x     ;
  24.   
  25. \ ( deg -F- rad ) converts degrees to radians
  26. : deg2Rad   PI f* 180. f/ ;
  27.  
  28. \ ( rad -F- deg ) converts radians to degrees
  29. : rad2Deg   180. f* PI f/ ;
  30.  
  31. : fmax ( f1 f2 -- fmax) f2dup f> IF fdrop ELSE swap fdrop THEN ;
  32. : fmin ( f1 f2 -- fmin) f2dup f< IF fdrop ELSE swap fdrop THEN ;
  33.  
  34. : arcsin { %x -- f }
  35.         %x fabs .3 f>= 
  36.         IF %x %x 1. f+ 1. %x f- f* sqrt f/ arctan
  37.         ELSE %x fabs f0>
  38.             IF %x 1. %x %x f* f- sqrt f/ arctan
  39.             ELSE 0.
  40.             THEN
  41.         THEN ;
  42.  
  43. : arccos { %x -- f }
  44.         1. %x f- 1. %x f+ f/ sqrt arctan 2. f* ;
  45.