home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / help / sfloat2.hlp < prev    next >
Encoding:
Text File  |  1988-08-02  |  6.5 KB  |  159 lines

  1. \ SFLOAT2    Second part of Software Floating-Point Package.
  2. \
  3. \               (c) Copyright 1988 by Robert L. Smith
  4. \                       2300 St Francis Dr.
  5. \                       Palo Alto, CA 94303
  6. \                          (415)856-9321
  7. \
  8. \       Permission is granted to use this package or its derivatives for
  9. \       private use.  For permission to use it in programs or packages
  10. \       sold for profit, please contact the author.
  11. \
  12.  
  13.  
  14. FCONSTANT   ( F: r -- )    \ When creating an FCONSTANT         \ FVG Required
  15.             ( F: -- r )  \ When using a created FCONSTANT.
  16.         Create a floating point constant.
  17.  
  18. FVARIABLE   ( -- )      \ At creation time.     \ FVG Required
  19.             ( -- addr ) \ At run time.
  20.         Create a floating point variable.
  21.  
  22. PI          ( F: -- r1 )                \ FVG Optional Transcendental
  23.         Push a floating point number with a value approximately equal to
  24.         pi.
  25.  
  26. FLN2        ( F: -- r1 )
  27.         Push a floating point number with a value approximately equal to
  28.         the natural logarthm of 2.
  29.  
  30. F0.0        ( F: -- r1 )
  31.         Push a floating point number with a value equal to 0.
  32.  
  33. F1.0        ( F: -- r1 )
  34.         Push a floating point number with a value equal to 1.
  35.  
  36. FLOG10E     ( F: -- r1 )
  37.         Push a floating point number with a value approximately equal to
  38.         the logarthm base 10 of e .
  39.  
  40. F10.0    ( F: -- r1 )
  41.         Push a floating point number with a value equal to 10.
  42.  
  43. FINFINITY  ( F: -- r1 )
  44.         Push the floating point number representing the largest
  45.         representable number onto the floating point stack.
  46.  
  47. F1.0+   ( F: r1 -- r2 )
  48.         Add 1 to the top floating point number.
  49.  
  50. F@   ( F: -- r ; addr -- )              \ FVG Required
  51.         Fetch the floating point number at the specified address and push
  52.         it onto the floating point stack.  Drop the address from the
  53.         parameter stack.
  54.  
  55. F!   ( F: r -- ; addr -- )              \ FVG Required
  56.         Store the floating point number at the top of the floating point
  57.         stack in the area specified by the address at the top of the
  58.         parameter stack.  Drop the address from the parameter stack and
  59.         drop the top element from the floating point stack.
  60.  
  61. F,   ( F: r -- )
  62.         Allot space at HERE and store the floating point number.
  63.         Similiar to  ,  .
  64.  
  65. 1/F     ( F: r1 -- r2 )
  66.         Take the reciprical of the floating point argument.
  67.  
  68. FLOAT     ( F: -- r ; dbl -- )          \ FVG Required
  69.         Convert the double number at the top of the parameter stack to a
  70.         floating point number which is then pushed onto the floating point
  71.         stack.  As with all double numbers, the location of the decimal
  72.         point is effectively ignored.
  73.  
  74. IFLOAT   ( F: -- r ; n -- )
  75.         Convert the single number at the top of the parameter stack to a
  76.         floating point number which is then pushed onto the floating point
  77.         stack.
  78.  
  79. DINTABS   ( F: r -- ; -- dbl flag )
  80.         Take the absolute value of the floating point number at
  81.         the top of the floating point stack and convert it to its double
  82.         integer value pushed onto the parameter stack.  The conversion
  83.         uses truncation, not rounding.  A flag is also pushed onto the
  84.         parameter stack indicating the success of the conversion.  If the
  85.         conversion succeeds, and the sign bit of the double number is not
  86.         set, a zero flag is returned.  If the conversion succeeds but is
  87.         sufficiently large that the sign bit of the double number is set,
  88.         the flag has all bits set EXCEPT the sign bit.  If the conversion
  89.         fails because the exponent is too large, the double number is
  90.         set to zero, and the flag is the unbiased exponent with the
  91.         most significant bit set.  Thus, one may use a 0< test on the
  92.         flag to insure that the conversion was successful.
  93.  
  94. FIX     ( F: r -- ; -- d )              \ FVG Required
  95.         Convert a floating point number to the nearest signed double
  96.         integer equivalent, removing the real number from the floating
  97.         point stack and leaving the double integer result on the Forth
  98.         parameter stack.  When the real number lies exactly halfway
  99.         between two integers, the result is the nearest EVEN number.
  100.         Underflow gives a zero result.  An error condition results if
  101.         the resulting number is too large to be represented as an
  102.         UNSIGNED double number.  If more error control is desired, you
  103.         may create your own version using DINTABS.
  104.  
  105. INT    ( F: r -- ; -- d )               \ FVG Required.
  106.         Convert a signed floating point number to its truncated double
  107.         integer value.  If the conversion did not succeed, report an error.
  108.  
  109. TINTA   ( F: r -- ; -- lo mid hi )
  110.         Convert absolute value of a floating number to triple precision
  111.         integer.  If the conversion did not succeed, report an error.
  112.  
  113. FINT   ( F: r1 -- r2 )
  114.         Replace a floating point number with another floating point number
  115.         representing the integer part of the first.
  116.  
  117. RENORM                          \ HIDDEN
  118.         A code level subroutine to normalize the number in (CX,AX,BX,DX).
  119.  
  120. F**+N   ( F: r1 -- r2 ; n -- )  \ HIDDEN
  121.         Raise the floating point number to the integral power specified by
  122.         the positive value on the top of the parameter stack.
  123.  
  124. F**N    ( F: r1 -- r2 ; n -- )
  125.         Raise the floating point number to the integral power specified by
  126.         the number on top of the parameter stack.
  127.  
  128. D2**N   ( n -- d )
  129.         Create a double integer equal to 2 raised to the n-th power.  This
  130.         is a 1 shifted left by n positions.
  131.  
  132.  
  133. F/PREM    ( F: r1 r2 -- urrem urquot )
  134.         Divide r1 by r2 to yield an unnormalized quotient and remainder.
  135.         If possible, the quotient is an integer, and the remainder is
  136.         exact.  The results are not rounded.  Used in trigonometric
  137.         functions.
  138.  
  139. LOGTAB1   ( -- addr )           \ HIDDEN
  140.         Table of logarithms for argument > 1
  141.  
  142. LOGTAB2   ( -- addr )           \ HIDDEN
  143.         Table of logarithms for argument < 1
  144.  
  145. FLN+                            \ HIDDEN
  146.         Label for code routine for logarithm for fractional part treated
  147.         as if 1.0 <= X < 1.5625.
  148.  
  149. FLN     ( F: r1 -- r2 )         \ FVG Required
  150.         Natural logarithm function.   Time: 1260 usec.
  151.  
  152. FLOG    ( F: r1 -- r2 )         \ FBG Required
  153.         Logarithm of base 10.
  154.  
  155. F/LN2   ( F: r -- r/ln2 )
  156.         Divide the floating point number by the natural logarithm of 2.
  157.  
  158.  
  159.