From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: Read +Inf from file/string
Date: 06 Nov 2002 12:38:41 -0500
Date: 2002-11-06T17:49:41+00:00 [thread overview]
Message-ID: <uy986k38e.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: aqafcu$mj2$1@newstoo.ericsson.se
"Atle R�stad" <aer@edh.ericsson.se> writes:
> Hi
>
> I want to read floating-points from a file. Some of the numbers can be
> +Inifinite. Is there a way to read inifinite floating points with gnat
> 3.13p?
Is the file in binary or ASCII?
> There is no problem in writing (put) an infinite number this will
> produce "+Inf****************", but how can i read (get) it?
This implies you are talking about ASCII. Since that format is not
valid for Ada.Text_IO, you'll have to do something else.
I'd suggest reading each number as a string, delimited by whatever
your delimiters are. Then check for the special case of "+Inf*"; if
it's not that, call Ada.Text_IO.Get (String). If it is "+Inf*", return
the appropriate floating point value, via Unchecked_Conversion.
--
-- Stephe
prev parent reply other threads:[~2002-11-06 17:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-06 7:21 Read +Inf from file/string Atle R�stad
2002-11-06 17:23 ` Georg Bauhaus
2002-11-06 17:38 ` Stephen Leake [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