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,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,886c71cc8d798d67 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.85.137 with SMTP id h9mr7146565paz.16.1351216007553; Thu, 25 Oct 2012 18:46:47 -0700 (PDT) Received: by 10.68.125.164 with SMTP id mr4mr6780145pbb.19.1351216007536; Thu, 25 Oct 2012 18:46:47 -0700 (PDT) Path: 6ni27259pbd.1!nntp.google.com!kt20no10806638pbb.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 25 Oct 2012 18:46:47 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.20.190.126; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 69.20.190.126 References: <277d0e8f-6b00-44e9-8d1f-1d25007fcc72@googlegroups.com> <1dd4109c-1190-4d51-ae57-d171a4d50f41@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <4e2d0db0-a0f0-499e-8e86-8a82aa3a949c@googlegroups.com> Subject: Re: Anouncement: OpenGL Binding w/ Ada-2012. From: Shark8 Injection-Date: Fri, 26 Oct 2012 01:46:47 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-10-25T18:46:47-07:00 List-Id: On Thursday, October 25, 2012 4:22:43 PM UTC-6, Quentin Ochem wrote: > >=20 > > Can it? I'd have to take a look at the way Ada's ranges for floats work= again to tell. IIRC it's [Min_val..Max_Val), if that is the case there is = one important value which is not precluded from the parameter of the new sp= ecification: 0.0. >=20 > Arf - you're entirely right on this, looked at this aspect to quickly. Yep, I've done that myself. > The alternative is to either use a definition starting at the first value= after 0.0: >=20 > subtype Positive_Float is Float range Float'Succ (0.0) .. Float'Last; True, that's a good one. Though I'm wondering if the Succ will be the next = normal value, or the next [possibly denormalized] value... I'll have to loo= k into that later, perhaps when dealing w/ OpenGL's 10-, 11-, and 16-bit fl= oating point numbers. > which admittedly is less readable. Alternatively, an Ada 2012 static pred= icate would work just as well: > subtype Positive_Float is Float=20 > with Static_Predicate =3D> Positive_Float > 0.0; >=20 > Given the amount of places where this notion of positive float is used, i= t's interesting to try out either of these two forms. Agreed. It would be interesting to see if the two methods are a: equivalent= , and b: if there's any performance difference between the two. Intuitively you would think they were the same, but there may be subtle dif= ferences... such as if the subtype's parent is an IEEE float, +Inf would be= a valid value for the predicate but an invalid value for the range {becaus= e we use subtype Safe_Float is Float'Range to weed out all the non-numeric = representations the Succ(0.0)..Float'Last range is a strict subset of Float= 'Range it too would exclude +Inf whereas a subtype w/ only the greater-than= -zero predicate might not.}