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-Thread: 103376,772ddcb41cd06d5b X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!newsfeed.freenet.de!newsfeed01.chello.at!newsfeed02.chello.at!news.hispeed.ch.POSTED!not-for-mail Message-Id: <12227360.svS57WvVVs@linux1.krischik.com> From: Martin Krischik Subject: Re: How to check a Float for NaN Newsgroups: comp.lang.ada Date: Mon, 05 May 2008 20:23:02 +0200 References: <3132e38d-18bb-4890-9cec-31056ac6e3ba@x19g2000prg.googlegroups.com> User-Agent: KNode/0.10.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@hispeed.ch Organization: hispeed.ch NNTP-Posting-Host: 84.75.166.64 (84.75.166.64) NNTP-Posting-Date: Mon, 05 May 2008 21:00:03 +0200 X-Trace: 0e0a3481f5933f1ee03e519966 Xref: g2news1.google.com comp.lang.ada:21185 Date: 2008-05-05T20:23:02+02:00 List-Id: Jerry wrote: > How would one check a Float or Long_Float if it has value NaN? The > only ways that I can come up with are to import a C function (isnan, I > think) or to write Long_Float'image(Some_Float) to a string and > examine the first three characters to see if they are "NaN" (and that > seems to be a GNAT implementation choice so might not be portable, > which is OK for my use). How about an Unchecked Conversion to an Unsigned_64 and comparing >2#0111_1111_1111_0000_0000_0000_0000_0000# Note that it's '>' as 2#0111_1111_1111_0000_0000_0000_0000_0000# is positive infinity. Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com