From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,3e4c0a2cc5056b4b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-06 09:49:42 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Read +Inf from file/string Date: 06 Nov 2002 12:38:41 -0500 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: skates.gsfc.nasa.gov 1036604981 17257 128.183.235.92 (6 Nov 2002 17:49:41 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 6 Nov 2002 17:49:41 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:30477 Date: 2002-11-06T17:49:41+00:00 List-Id: "Atle R�stad" 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