🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #220

Re: Fixed Point Output with WriteReal

#220
From: "Mr Sten-]ke Lindell"
Date: Tue, 15 Aug 1989 15:05
32 lines
1344 bytes
In article <INFO-M2%89080522371415@UCF1VM> you write:
>
>   Hi. I'm a neophyte in Modula-2 and I have a very simple question to
>ask.  Is it possible to get fixed point rather than floating point
>output using WriteReal (a la FORTRAN F6.3 for eg).  The book that
>I'm using now does not mention anything about fixed point output, so
>maybe I'm missing something.  Would appreciate a reply.  Thanks.
>
>Chua KS.

MODULE Gazonk;

FROM InOut IMPORT
   WriteLn, WriteString;

FROM RealConversions IMPORT
   RealToString;

PROCEDURE WriteFix (R : REAL; Dec, Width : CARDINAL);
VAR
   tmpstr : ARRAY [0..80] OF CHAR;
   ok     : BOOLEAN;

BEGIN
   RealToString (R, INTEGER (Dec), INTEGER (Width), tmpstr, ok);
   WriteString (tmpstr)
END WriteFix;

BEGIN
   WriteFix (42.666, 3, 6);
   WriteLn;
END Gazonk.
Technical Details
Message-ID: <8908151505.AA06594@kuling.DoCS.UU.SE>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!att!ucbvax!KULING.DOCS.UU.SE!stenake
References: <INFO-M2%89080522371415@UCF1VM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!att!ucbvax!KULING.DOCS.UU.SE!stenake
From: stenake@KULING.DOCS.UU.SE ("Mr Sten-]ke Lindell")
Newsgroups: comp.lang.modula2
Subject: Re: Fixed Point Output with WriteReal
Message-ID: <8908151505.AA06594@kuling.DoCS.UU.SE>
Date: 15 Aug 89 15:05:09 GMT
References: <INFO-M2%89080522371415@UCF1VM>
Sender: daemon@ucbvax.BERKELEY.EDU
Reply-To: Modula2 List <INFO-M2%UCF1VM.bitnet@jade.berkeley.edu>
Organization: Dept. of Computer Systems, Uppsala University, Sweden
Lines: 32