comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Range excluding 0.0
Date: Sun, 30 Aug 2009 09:34:06 +0200
Date: 2009-08-30T09:34:01+02:00	[thread overview]
Message-ID: <1t74k6wjtgo78.1b6d2g7uwt230$.dlg@40tude.net> (raw)
In-Reply-To: nospam-09C501.16515629082009@news.aioe.org

On Sat, 29 Aug 2009 16:51:56 -0400, John B. Matthews wrote:

> In article <1j57hiw.vmezw81qexbi6N%csampson@inetworld.net>,
>  csampson@inetworld.net (Charles H. Sampson) wrote:
> 
> [...]
>>      This is not just theoretical musing.  I currently work in the 
>> world of compasses, so a range of the form [0.0 .. 360.0) is quite 
>> natural. (That notation is neither mathematical nor Ada.  I hope its 
>> meaning is clear.)
> 
> I'd be torn between these, but wrapping around the right end would be a 
> problem with either:
> 
> subtype Heading is Float range 0.0 .. 360.0;
> subtype Heading is Float range 0.0 .. Float'Pred(360.0);
> 
> If the range were intended to model a craft's heading (perhaps in 
> degrees, minutes & seconds), I'd be tempted to consider a modular type:

Still using non-metric units, guys? (:-))
 
> type Heading is mod 360 * 60 * 60;
> 
> This might make a relative change in heading easier to implement.

   Second : constant := 1.0 / (60.0 * 60.0);
   type Heading is delta Second range 0.0..360.0 - Second;

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2009-08-30  7:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-29 12:50 Range excluding 0.0 vlc
2009-08-29 13:12 ` Dmitry A. Kazakov
2009-08-29 13:46 ` John B. Matthews
2009-08-29 17:10   ` vlc
2009-08-29 17:47 ` Charles H. Sampson
2009-08-29 19:28   ` Robert A Duff
2009-08-30 18:34     ` Charles H. Sampson
2009-08-29 20:51   ` John B. Matthews
2009-08-30  7:34     ` Dmitry A. Kazakov [this message]
     [not found]       ` <7_KdnXzM3cepeAfXnZ2dnUVZ_vidnZ2d@earthlink.com>
2009-08-31  7:37         ` Dmitry A. Kazakov
2009-08-31 13:58           ` John B. Matthews
2009-08-31 18:49             ` Dmitry A. Kazakov
2009-09-01 18:10               ` Keith Thompson
     [not found]             ` <iradnblskszGlgHXnZ2dnUVZ_oSdnZ2d@earthlink.com>
2009-09-01  0:36               ` John B. Matthews
2009-08-30  7:38   ` Dmitry A. Kazakov
2009-08-30 18:34     ` Charles H. Sampson
2009-08-30 20:43       ` Dmitry A. Kazakov
replies disabled

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