(* $N- *)
DEFINITION MODULE LongRealConversions; (* jr/28mai87 *)

PROCEDURE StrToReal(VAR s: ARRAY OF CHAR; VAR r: LONGREAL;
                    VAR err: BOOLEAN);

(* Converts input string 's' to a real number 'r'.

   Possible error conditions:
    - 's' has a syntactical error
    - 'r' would be too large for a LONGREAL
*)


PROCEDURE RealToStr(r: LONGREAL; VAR s: ARRAY OF CHAR;
                    m, n: INTEGER; expo: BOOLEAN; VAR err: BOOLEAN);

(* Converts the real number 'r' to output string 's'. The output  string  will
   have a length of EXACTLY 'm' characters  (or length of 's'  if  'm'  is too
   large). 'n' is the number of places behind the decimal point. If 'n' is too
   large in respect to 'm' it will be shortened to the maximum possible.If 'n'
   is zero then the decimal point will be omitted.  With 'expo' you can choose
   the exponential mode of output.
   A few examples:   r=12.976   m   n   expo     s
                                5   2  FALSE  '12.98'
                                4   2  FALSE  '13.0'
				3   2  FALSE  ' 13'
				2   2  FALSE  '13'
				1   2  FALSE  # err #
			       -8   2  FALSE  '12.98   '
			       10   2   TRUE  '  1.30E+01'
   
   Possible error conditions:
    - 'm' is zero OR 'n' is negative
    - 's' is to small to hold the string representing 'r'
*)

END LongRealConversions.
