SREALIO.DEF 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. DEFINITION MODULE SRealIO;
  2. (* Input and output of real numbers in decimal text form over default
  3. channels.
  4. The read result is of the type IOConsts.ReadResults.
  5. *)
  6. (* The text form of a signed fixed-point real number is
  7. ["+"|"-"], decimal digit, {decimal digit}, [".", {decimal digit}] *)
  8. (* The text form of a signed floating-point real number is
  9. signed fixed-point real number,
  10. "E", ["+"|"-"], decimal digit, {decimal digit} *)
  11. PROCEDURE ReadReal (VAR real : REAL);
  12. (* Skips leading spaces and removes any remaining characters
  13. that form part of a signed fixed or floating point number.
  14. A corresponding value is assigned to the parameter real.
  15. The real result is set to the value allRight, outOfRange, wrongFormat,
  16. endOfLine, or endOfInput. *)
  17. PROCEDURE WriteFloat (real : REAL;
  18. sigFigs : CARDINAL;
  19. width : CARDINAL);
  20. (* Writes the value of the parameter real in floating-point text form
  21. with sigFigs significant figures in a field of the given minimum width. *)
  22. PROCEDURE WriteEng (real : REAL;
  23. sigFigs : CARDINAL;
  24. width : CARDINAL);
  25. (* As for WriteFloat except that the number is scaled with one to
  26. three digits in the whole number part and with an exponent that is
  27. a multiple of three. *)
  28. PROCEDURE WriteFixed (real : REAL;
  29. place : INTEGER;
  30. width : CARDINAL);
  31. (* Writes the value of the parameter real in fixed-point text form,
  32. rounded to the given place relative to the decimal point,
  33. in a field of the given minimum width. *)
  34. PROCEDURE WriteReal (real : REAL;
  35. width : CARDINAL);
  36. (* Writes the value of real as WriteFixed if the sign and magnitude
  37. can be shown in the given width, otherwise as WriteFloat.
  38. The number of places or significant digits depend on the given width. *)
  39. END SRealIO.