comp.lang.ada
 help / color / mirror / Atom feed
From: Alfred.Peterson@SEI.CMU.EDU
Subject: Re: Need help on float_io format
Date: Wed, 11-Nov-87 11:39:52 EST	[thread overview]
Date: Wed Nov 11 11:39:52 1987
Message-ID: <1987.11.11.16.11.24.Alfred.Peterson@sei.cmu.edu> (raw)
In-Reply-To: 7785@steinmetz.steinmetz.UUCP

>In FORTRAN, the free format output of 23.35 is 0.2335000+02.
>I just discovered that there is no way to let Ada print out 23.35
>as 0.2335000+02. I tried AFT and EXP control parameters and I always got
>2.335000+01. Do I miss something? Can any one out there tell me
>what's wrong? Thanks in advance.
>     Ko-Haw Nieh
>     General Electric Company 
>     Corporate Research and Development
>     nieh@ge-crd.arpa
>     518-387-7431


Yes, unfortunately, Text_Io is REQUIRED to behave as you specify above.
ARM 14.3.8 (Input-Output for Real Types) para. 13 states "If EXP has the
value zero, then the integer part to be output has as many digits as are
needed to represent the integer part of the value of ITEM [in the overloaded
procedures PUT above], overriding FORE if necessary, or consists of the digit
zero if the value of ITEM has no integer part."

The next paragrah states "If EXP has a value greater than zero, then the
integer part to be output has a single digit, which is nonzero except for
the value 0.0 of ITEM."

The ramification of the two paragraphs is that the predefined Text_Io package
can NEVER produce the output that you would like and be validable.  I believe
that the premise for the required Text_Io format is that it follows that of
the 'standard' scientific notation form for writing real numbers.

Spencer Peterson
Member of the Technical Staff
Software Engineering Institute
Carnegie Mellon University
Pittsburgh, PA  15213
412-269-7608
asp@sei.cmu.edu

      parent reply	other threads:[~1987-11-11 16:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1987-11-06  4:38 Need help on float_io format nico nieh
1987-11-08 17:14 ` stt
1987-11-11 16:39 ` Alfred.Peterson [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox