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=-0.9 required=5.0 tests=BAYES_00,FROM_NUMERIC_TLD autolearn=no 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!feeder1.cambrium.nl!feed.tweaknews.nl!tudelft.nl!txtfeed1.tudelft.nl!zen.net.uk!dedekind.zen.co.uk!news-peer-lilac.gradwell.net!not-for-mail From: "Stuart" Newsgroups: comp.lang.ada 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> <48197575$1_1@glkas0286.greenlnk.net> Subject: Re: How to check a Float for NaN Date: Thu, 1 May 2008 18:14:09 +0100 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 Message-ID: <4819f65b$1_1@glkas0286.greenlnk.net> X-Original-NNTP-Posting-Host: glkas0286.greenlnk.net NNTP-Posting-Host: 20.133.0.1 X-Trace: 1209662058 news.gradwell.net 657 dnews/20.133.0.1:51185 X-Complaints-To: news-abuse@gradwell.net Xref: g2news1.google.com comp.lang.ada:21163 Date: 2008-05-01T18:14:09+01:00 List-Id: "Adam Beneschan" wrote in message news:fe6a8cc1-eac7-4b25-bd21-39f9c2015c4a@k1g2000prb.googlegroups.com... > On May 1, 1:04 am, "Stuart" wrote: >> "Adam Beneschan" wrote in message > >> > 13.9.2(4-11) lists the ways >> > that invalid data could be created, and the "result of a floating- >> > point operation that cannot return a valid result" is not one of those >> > listed. Yes, I know that this is a NOTE and is not normative.) >> >> Would not 13.9.2(10) cover this: >> "disrupting an assignment due to the failure of a language-defined >> check >> (see 11.6)" > > Did you read 11.6? I tried, but legalese is not my first language and I find some of the 'language lawyerly' stuff rather impenetrable at times. ;-) > I think all this says is that if an assignment statement raises an > exception (due to a language-defined check), then in the exception > handler and further on in the code, you can't count on the value of > the target object being normal. You can't count on it being abnormal, > either. But if no exception is raised, then this doesn't apply. I agree with what you are saying here; which I read as 'you can't count on the target object being obviously invalid (e.g. a NaN), but it _could_ be'. As such 13.9.2(10) appears to support a case by which a NaN value could arise in an object during computation. In a nominal Ada program it would be sensible to deal with the situation in the exception handler, rather than let it slide and try and resolve it later using 'valid. But then, I think, we are picking-over the innards of some murky corner case of the language - so good-sense need not apply ;-) I would hazard a guess that we have strayed well away from the OP's original area of interest (he was probably validating inputs), and as you noted earlier. Regards -- Stuart