Modula-2 || Compiler & Tools || Library || Search Engine
TYPE ReadProc = PROCEDURE(VAR CHAR); VAR Done: BOOLEAN; VAR termCH: CHAR;
PROCEDURE ReadReal(Read: ReadProc; VAR x: REAL); PROCEDURE WriteFloat(VAR f: ARRAY OF CHAR; x: REAL; base: CARDINAL; dp: CARDINAL); PROCEDURE WriteFix(VAR f: ARRAY OF CHAR; x: REAL; base: CARDINAL; VAR dp: CARDINAL);
["+" | "-"] digit { digit } ["." digit { digit } ] ["E" ["+" | "-"] digit [digit] ]The last character returned by Read will be stored into termCH. Read is expected to return 0C in case of errors or end of input.
WriteFloat and WriteFix convert x into an array of characters that is returned in f. Valid bases are 8, 10, and 16. The number of decimal places after the dot is specified by dp. WriteFloat uses a normalized exponent notation while WriteFix suppresses the exponent which may result in very long result strings for very large or small arguments. WriteFix adjusts dp if necessary.
Modula-2 || Compiler & Tools || Library || Search Engine