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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.182.104.161 with SMTP id gf1mr509705obb.45.1400801631495; Thu, 22 May 2014 16:33:51 -0700 (PDT) X-Received: by 10.50.78.38 with SMTP id y6mr202igw.8.1400801631315; Thu, 22 May 2014 16:33:51 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!newsfeed.fsmpi.rwth-aachen.de!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!news.glorb.com!hl10no3875304igb.0!news-out.google.com!gi6ni6673igc.0!nntp.google.com!hl10no3875286igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 22 May 2014 16:33:50 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=KSa2aQoAAACOxnC0usBJYX8NE3x3a1Xq NNTP-Posting-Host: 66.126.103.122 References: <3132e38d-18bb-4890-9cec-31056ac6e3ba@x19g2000prg.googlegroups.com> <83ce619a-beef-447f-91ef-ff3dd68ff9df@googlegroups.com> <3tso4mcv80hk.8j7e1grtnha0$.dlg@40tude.net> <6c8f74c9-4b4e-47a0-90e0-efa1ecdd5e2e@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: How to check a Float for NaN From: Adam Beneschan Injection-Date: Thu, 22 May 2014 23:33:51 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:19975 Date: 2014-05-22T16:33:50-07:00 List-Id: On Thursday, May 22, 2014 9:31:12 AM UTC-7, Dmitry A. Kazakov wrote: > > No, I don't think so. 3.5.7(8) says "The set of values for a floating > > point type is the (infinite) set of rational numbers." This excludes N= aN > > and infinities, which are not rational numbers (nor any kind of number)= . >=20 > These are not values of Long_Float. I guess that values of Long_Float are > "machine numbers" defined in the following sentence. I'm not sure why the RM defined the "set of values" to be an infinite set; = I'm sure that this made the rest of the semantics easier to specify in some= way, but I don't know what that is. The set of *machine numbers* for a ty= pe is a subset of this set of values. I think that intermediate computatio= ns can involve numbers that aren't machine numbers (if they're performed us= ing a type with greater precision, for example); I'm not sure. In any case= , though, it's clear that infinities and NaN aren't part of the "set of val= ues", and thus they can't be part of the set of machine numbers which is a = subset of the "set of values". > Why doesn't it preclude NaN returned and accepted by arithmetic operation= s?=20 > Either 3.5.7 lies or the operations do. I think it *does* preclude NaN, unless I don't understand what you mean. I= guess you could say that the "operations lie", because if Machine_Overflow= s is False, an operation on two values of a floating-point type may have an= invalid result. Normally, that's not supposed to happen. But we can cons= ider Machine_Overflows=3DFalse to work somewhat similarly to a Suppress pra= gma in that undefined results may happen. If B is a Boolean variable whose= value is True, what does B :=3D Boolean'Succ(B) do if Suppress(Range_Check= ) is in effect? It will quite possibly set B to something that is not a va= lid Boolean value. But I'm not sure that means the 'Succ operation is lyin= g. And I don't think that the arithmetic operations "lie" any more than 'S= ucc is in this example. -- Adam