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!news1.google.com!postnews.google.com!p25g2000pri.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: How to check a Float for NaN Date: Wed, 30 Apr 2008 16:23:13 -0700 (PDT) Organization: http://groups.google.com Message-ID: <1216f027-8fa4-45df-9b84-ae387164505b@p25g2000pri.googlegroups.com> References: <3132e38d-18bb-4890-9cec-31056ac6e3ba@x19g2000prg.googlegroups.com> <6f7cd771-16b7-4729-9536-2a7d1c28a9cd@2g2000hsn.googlegroups.com> <93b0d930-102a-4ac4-8b85-48e87d9d3df1@j33g2000pri.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1209597794 21425 127.0.0.1 (30 Apr 2008 23:23:14 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 30 Apr 2008 23:23:14 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p25g2000pri.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:21154 Date: 2008-04-30T16:23:13-07:00 List-Id: On Apr 30, 1:33 pm, Jerry wrote: > Thanks for the insight. From my point of view, not having access to > the all the IEEE-754 features is a nuisance. I'm not sure what I'm > going to do--probably try in import the C function isnan. Be careful with that, too. On my (Pentium Linux) system, the man page for "isnan" says it takes a "double", which I think means a 64-bit float. You'll probably be OK if you use a 64-bit float type (probably Long_Float). But if you want to test a 32-bit float type, I don't see a C function that works on 32-bit floats, and doing an Ada type conversion is very likely to fail---probably cause a processor fault when the compiler generates a floating-point conversion instruction and the processor then faults because you gave it a NaN as an instruction operand. -- Adam