Modula-2 || Compiler & Tools || Library || Search Engine


Ulm's Modula-2 Library:
RealInOut


NAME

RealInOut - i/o with real numbers

SYNOPSIS

FROM StdIO IMPORT FILE;


VAR Done: BOOLEAN;

PROCEDURE ReadReal(VAR x: REAL); PROCEDURE FreadReal(f: FILE; VAR x: REAL); PROCEDURE WriteReal(x: REAL; n: CARDINAL); PROCEDURE FwriteReal(f: FILE; x: REAL; n: CARDINAL); PROCEDURE WriteFloat(x: REAL; pd: CARDINAL; dp: CARDINAL); PROCEDURE FwriteFloat(f: FILE; x: REAL; pd: CARDINAL; dp: CARDINAL); PROCEDURE WriteRealOct(x: REAL); PROCEDURE FwriteRealOct(f: FILE; x: REAL); PROCEDURE WriteRealHex(x: REAL); PROCEDURE FwriteRealHex(f: FILE; x: REAL);

DESCRIPTION

ReadReal, FreadReal read a real number x from StdIO.stdin / f according to following syntax:

["+" | "-"] digit { digit } ["." digit { digit } ]
["E" ["+" | "-"] digit [digit] ]

At most 16 digits, besides leading zeroes, are significant. Maximum exponent is 76. Input terminates with a blank or any control character.

WriteReal, FwriteReal write x using n characters. If less than n characters are needed, leading blanks are inserted.

WriteFloat, FwriteFloat write x in fixed point notation using pd digits in front of decimal point and dp digits behind decimal point. If less than pd digits are needed, leading blanks are inserted.

WriteRealOct, FwriteRealOct and WriteRealHex, FwriteRealHex write x in octal/hexadecimal format.

DIAGNOSTICS

Done is TRUE on successfull calls, otherwise FALSE.

SEE ALSO

StdIO, Terminal

HISTORY

An equally named module was written by Niklaus Wirth for the Lilith system. The current implementation is due to Andreas Borchert and Wilfried Schwartz
Edited by: borchert, last change: 1997/02/25, revision: 1.2, converted to HTML: 1997/04/28

Modula-2 || Compiler & Tools || Library || Search Engine