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 Path: g2news2.google.com!postnews.google.com!t12g2000prg.googlegroups.com!not-for-mail From: Jerry Newsgroups: comp.lang.ada Subject: Re: How to check a Float for NaN Date: Fri, 9 May 2008 19:36:58 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <3132e38d-18bb-4890-9cec-31056ac6e3ba@x19g2000prg.googlegroups.com> NNTP-Posting-Host: 75.171.61.127 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1210387019 11061 127.0.0.1 (10 May 2008 02:36:59 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 10 May 2008 02:36:59 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: t12g2000prg.googlegroups.com; posting-host=75.171.61.127; posting-account=x5rpZwoAAABMN2XPwcebPWPkebpwQNJG User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:5757 Date: 2008-05-09T19:36:58-07:00 List-Id: On May 9, 12:49=A0pm, a...@anon.org (anon) wrote: > =A0 -- > =A0 -- Nan is define to be greater than value of hex 16#FF000000# > =A0 -- > > =A0 function isNan ( N : Float ) return Boolean is > > =A0 =A0 =A0T : Long_Long_Integer :=3D Long_Long_Integer ( N ) ; > > =A0 =A0 begin > =A0 =A0 =A0 if T > 16#FF000000# then > =A0 =A0 =A0 =A0 return True ; > =A0 =A0 =A0 else > =A0 =A0 =A0 =A0 return False ; > =A0 =A0 =A0 end if ; > =A0 =A0 end ; > > In <3132e38d-18bb-4890-9cec-31056ac6e...@x19g2000prg.googlegroups.com>, Je= rry writes: > > >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). > > >Jerry No offense to anon, but does this work? Does anyone know of a reference for this definition of a NaN? Also, wondering how one might detect an Inf. It seems that there is enough information in this thread to begin writing a little package to deal with some of these things. Thanks for all the great tips, BTW. Jerry