home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / MODULAV2GERMAN.DMS / in.adf / Def.zoo / FFPConversions.def < prev    next >
Encoding:
Modula Definition  |  1988-06-14  |  1.3 KB  |  41 lines

  1. (* $N- *)
  2. DEFINITION MODULE FFPConversions; (* jr/28mai87 *)
  3.  
  4. FROM SYSTEM IMPORT FFP;
  5.  
  6. PROCEDURE StrToReal(VAR s: ARRAY OF CHAR; VAR r: FFP;
  7.                     VAR err: BOOLEAN);
  8.  
  9. (* Converts input string 's' to a FFP number 'r'.
  10.  
  11.    Possible error conditions:
  12.     - 's' has a syntactical error
  13.     - 'r' would be too large for a FFP
  14. *)
  15.  
  16.  
  17. PROCEDURE RealToStr(r: FFP; VAR s: ARRAY OF CHAR;
  18.                     m, n: INTEGER; expo: BOOLEAN; VAR err: BOOLEAN);
  19.  
  20. (* Converts the FFP number 'r' to output string 's'. The output  string  will
  21.    have a length of EXACTLY 'm' characters  (or length of 's'  if  'm'  is too
  22.    large). 'n' is the number of places behind the decimal point. If 'n' is too
  23.    large in respect to 'm' it will be shortened to the maximum possible.If 'n'
  24.    is zero then the decimal point will be omitted.  With 'expo' you can choose
  25.    the exponential mode of output.
  26.    A few examples:   r=12.976   m   n   expo     s
  27.                                 5   2  FALSE  '12.98'
  28.                                 4   2  FALSE  '13.0'
  29.                 3   2  FALSE  ' 13'
  30.                 2   2  FALSE  '13'
  31.                 1   2  FALSE  # err #
  32.                    -8   2  FALSE  '12.98   '
  33.                    10   2   TRUE  '  1.30E+01'
  34.    
  35.    Possible error conditions:
  36.     - 'm' is zero OR 'n' is negative
  37.     - 's' is to small to hold the string representing 'r'
  38. *)
  39.  
  40. END FFPConversions.
  41.