Category : Modula II Source Code
Archive   : M2CMP20.ZIP
Filename : REALCONV.DEF

 
Output of file : REALCONV.DEF contained in archive : M2CMP20.ZIP
DEFINITION MODULE RealConversions;

(* (C) Copyright 1987,1988 Fitted Software Tools. All rights reserved. *)


PROCEDURE RealToString( x :REAL; decDigits, n :INTEGER;
VAR s :ARRAY OF CHAR; VAR ok :BOOLEAN );
(*
Converts x to an ASCII representation.
n is the width of the ASCII field.
ABS(decDigits) is the number of decimal digits desired.
s is where the result is placed.
ok is set to TRUE is the conversion was successful.

The output in s is in fixed point notation if decDigits is positive;
otherwise, x is represented in scientific notation.

If n is greater than the number of characters needed for the conversion,
s is padded with spaces on the left.
If decDigits > 0 then n must be >= decDigits+2
else n must be >= ABS(decDigits)+7

Examples:

RealToString( 1.148, 2, 6, s, ok ) would place in s:
" 1.15"

RealToString( 1.148, -2, 10, s, ok ) would place in s:
" 1.15E+00"
*)

PROCEDURE StringToReal( s :ARRAY OF CHAR; VAR x :REAL; VAR ok :BOOLEAN );
(*
converts the string s into a REAL number.
a real in the format defined for Modula-2 REAL literals is expected.
*)

PROCEDURE LongRealToString( x :LONGREAL; decDigits, n :INTEGER;
VAR s :ARRAY OF CHAR; VAR ok :BOOLEAN );
(*
works like RealToString
*)

PROCEDURE StringToLongReal( s :ARRAY OF CHAR;
VAR x :LONGREAL; VAR ok :BOOLEAN );
(*
works like StringToReal
*)


END RealConversions.

  3 Responses to “Category : Modula II Source Code
Archive   : M2CMP20.ZIP
Filename : REALCONV.DEF

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/