comp.lang.ada
 help / color / mirror / Atom feed
From: kst@aonix.com (Keith Thompson)
Subject: Re: Newbe compile problems
Date: 1996/12/19
Date: 1996-12-19T00:00:00+00:00	[thread overview]
Message-ID: <E2nCCv.Fnp@thomsoft.com> (raw)
In-Reply-To: AAlsyjoyZ4@geol.spb.su


In <AAlsyjoyZ4@geol.spb.su> Sazonov Cyril <cyril@geol.spb.su> writes:
[...]
> As for me I've found two places where may be errors:
> 
> #1 >> with Float_Text_IO;
> 
> Are you sure that this package exists? The standard package is called
> TEXT_IO.FLOAT_IO.

Text_IO.Float_IO is a generic package, not a package.  Float_Text_IO
should be Ada.Float_Text_IO, a predefined instantiation of
Ada.Text_IO.Float_IO for type Float (this is new to Ada 95).

(Incidentally, at least one Ada 83 compiler, RISCAda, provides a similar
implementation-defined pre-instantiation called Float_Text_IO.)

> Or if the IO package is of your own, then check whether its has been compiled
> _before_ you're trying to compile your sample.
> 
> #2 >>  A, B : FLOAT := 0.0;
> 
> This may an error too, the thing is that decimal IS NOT a sign of a FLOAT-type
> constant, it is a sign of a FIXED-type constant. The FLOAT-type constant
> should be written so 12.34E56, it IS to have a power_of_ten postfix. This
> detail is mentioned in the LRM ( I've got the Ada83 one only ).

No, that's incorrect.  Ada doesn't have floating-point or fixed-point
literals; it has real literals, which are of type universal_real.
The decimal point is mandatory; the exponent part is optional.  A real
literal like 0.0 or 12.34E56 can be implicitly converted to any real
(floating-point or fixed-point) type.  Less precisely, floating-point
and fixed-point literals have identical syntax.

One possible source of confusion here is that Ada 95 allows a relaxed
syntax (relative to Ada 83) for real literals on input.  For example,
Float_Text_IO.Get or Float'Value will accept any of "0.0", "0.", ".0", or
"0".  This relaxed syntax applies only to input, not to literals in Ada
source programs.

-- 
Keith Thompson (The_Other_Keith) kst@aonix.com <http://www.aonix.com> <*>
TeleSo^H^H^H^H^H^H Alsy^H^H^H^H Thomson Softw^H^H^H^H^H^H^H^H^H^H^H^H^H Aonix
10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2706
"SPOON!" -- The Tick




  parent reply	other threads:[~1996-12-19  0:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-18  0:00 Newbe compile problems Sazonov Cyril
1996-12-19  0:00 ` Robert Dewar
1996-12-19  0:00 ` Keith Thompson [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-12-24  0:00 Sazonov Cyril
1996-12-16  0:00 Jamie Amendolagine
1996-12-17  0:00 ` Robert Dewar
1996-12-19  0:00 ` David Wheeler
1996-12-19  0:00   ` Larry Kilgallen
1996-12-15  0:00 James Amendolagine
1996-12-15  0:00 ` Tom Moran
1996-12-15  0:00 ` Robert Dewar
1996-12-16  0:00 ` Richard Curnow
1996-12-17  0:00 ` David Wheeler
1996-12-19  0:00   ` Jesse E. Smith
replies disabled

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