comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Ada202X : alternate syntax for ranged scalars
Date: Wed, 1 May 2013 21:11:50 -0500
Date: 2013-05-01T21:11:50-05:00	[thread overview]
Message-ID: <klsi1b$q52$1@munin.nbi.dk> (raw)
In-Reply-To: 3861a3cd-2513-4871-9062-2f2a53eb106b@googlegroups.com

"Eryndlia Mavourneen" <eryndlia@gmail.com> wrote in message 
news:3861a3cd-2513-4871-9062-2f2a53eb106b@googlegroups.com...
>...
> That said, we must assume that floating point values get translated 
> *exactly*; that is,
>360.0 does not get translated to a machine type of 359.999999... or 
>360.0111111...

Which of course makes no sense for most literals; it can only make sense for 
values that already correspond to machine numbers, and those already require 
exact conversion.

The problem I see with such syntax is what precisely happens when the bound 
is not specified as a machine number? Say:
                     type My_Flt digits 5 range not 0.6 .. not 2.6;

Is this the same as the range without the "nots"? Or is it requiring 
something less than some unknown value in a particular interval? I don't see 
how that would be useful. Or are you going to require selecting a 
*particular* machine number in this case? That would be a massive change 
from the behavior of Ada currently, and probably would break some programs 
(that aren't portable but do work) be changing the values of their literals.

The bounds of the range have to be machine numbers, as they don't have to be 
static; as such, we don't care about values that aren't machine numbers. So 
what exactly is this gaining over:

        subtype My_Flt is Float range Float'Succ(0.0)..Float'Pred(360.0);

                                         Randy.




  reply	other threads:[~2013-05-02  2:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-26 10:10 Ada202X : alternate syntax for ranged scalars Martin
2013-04-26 10:35 ` Peter C. Chapin
2013-04-26 12:26 ` Eryndlia Mavourneen
2013-05-02  2:11   ` Randy Brukardt [this message]
2013-05-02 13:29     ` Eryndlia Mavourneen
2013-04-26 12:53 ` AdaMagica
2013-04-26 14:46   ` Shark8
2013-04-28  2:11   ` Stephen Leake
2013-04-26 16:55 ` Jeffrey Carter
2013-05-02 23:05 ` Jerry
2013-05-14 22:30 ` Martin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox