Article View: comp.os.vms
Article #15498Re:Re:Re: VAX Pascal writeln on real numbers
From: Steve Rollinson
Date: Mon, 01 May 1989 04:14
Date: Mon, 01 May 1989 04:14
56 lines
2479 bytes
2479 bytes
In article <6963@bsu-cs.bsu.edu>, neubauer@bsu-cs.bsu.edu (Paul Neubauer) writes:
...................................etc...................
> Sorry, that is not what is going on here. The following short program shows
> that it always counts 0 as positive and always expands the field width to
> include everything to the left of the .:
>
> PROGRAM Signs (output);
>
> BEGIN
> writeln(-0.000001:6:4);
> writeln(-0.000001:7:4);
> writeln(-1.000001:6:4);
> writeln(-1.000001:7:4);
> END. {program Signs}
>
> The output from this program is:
>
> 0.0000
> 0.0000
> -1.0000
> -1.0000
>
...............................etc...........................
If you want your numbers to line up, you should use the
same field widths throughout....
BEGIN
writeln(-0.000001:7:4);
writeln(-0.000001:7:4);
writeln(-1.000001:7:4);
writeln(-1.000001:7:4);
END. {program Signs}
I seem to recall that the decimal point counts as a character
position in the integer part of the format, therefore -0.000001:6:4
would completely fill the field "0.0000"
123456
and -000001:7:4 would be represented by " 0.0000"
1234567
... as essentially real numbers are displayed right justified. I believe
that when the number "displayed" is <0 the output still allows the "-"
to be displayed, thus allowing 1 more character in the output format.
(Feel free to flame me if I'm wrong)
-------------------------------------------------------------------------------
_ __ | _ _ | Steven Rollinson
( ` / ) / / | @ @ | Curtin University of Technology
\ /--< _ / / . __ _ _ __ | > | Computing Centre
\_) / |/(_)_/_/_<_/ /_\/(_)_/ /_ | ~ | Western Australia
| | PSI%AUSTPAC.0505294523000::CSJR
-------------------------------------------------------------------------------
Technical Details
Message-ID:
<71@admdev.cut.oz>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!lll-winken!uunet!munnari!uniwa!vax7!csjrReferences:
<2744@cps3xx.UUCP> <6953@bsu-cs.bsu.edu> <6963@bsu-cs.bsu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!lll-winken!uunet!munnari!uniwa!vax7!csjr From: csjr@admdev.cut.oz (Steve Rollinson) Newsgroups: comp.os.vms,comp.lang.pascal Subject: Re:Re:Re: VAX Pascal writeln on real numbers Message-ID: <71@admdev.cut.oz> Date: 1 May 89 04:14:14 GMT References: <2744@cps3xx.UUCP> <6953@bsu-cs.bsu.edu> <6963@bsu-cs.bsu.edu> Organization: Curtin University of Technology Lines: 55