comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: type declaration and storage requirements
Date: 04 Jun 2002 11:35:40 +0100
Date: 2002-06-04T11:35:40+01:00	[thread overview]
Message-ID: <x7vptz79vr7.fsf@pushface.org> (raw)
In-Reply-To: bebbba07.0206021321.a3bbfac@posting.google.com

18k11tm001@sneakemail.com (Russ) writes:

> Suppose I have a particular range in mind, and I just want to get
> the maximum number of digits I can get for, say, a 32-bit word. Is
> there a simple way to determine how many digits to specify? If I
> specify one digit too many, can it step the storage requirement from
> one to two words? I'm no expert, but it seems to me that what you
> really want to be able to specify is not the number of digits but
> rather the total number of bytes to be used.

If your requirement is to specify a size for the values, say

  type My_Short_Float_Type is new Float;
  type My_Long_Float_Type is new Long_Float;

or

  subtype My_Short_Float_Type is Float;
  subtype My_Long_Float_Type is Long_Float;

which are pretty likely to map to C float and double.

If on the other hand your requirement is to specify the precision your
algorithm requires, you really do need

  type My_Float_Type is digits 7;

and if it turns out that that needs 8 bytes (ie double), so be it.



  parent reply	other threads:[~2002-06-04 10:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-02 21:21 type declaration and storage requirements Russ
2002-06-02 23:54 ` martin.m.dowie
2002-06-03  0:40   ` Dale Stanbrough
2002-06-03 11:10     ` martin.m.dowie
2002-06-04  2:40       ` Dale Stanbrough
2002-06-03  6:58   ` Russ
2002-06-03  7:57     ` AG
2002-06-03 11:19     ` martin.m.dowie
2002-06-03 12:40     ` Larry Kilgallen
2002-06-03 13:12     ` Gautier
2002-06-03  2:26 ` Jeffrey Carter
2002-06-04 10:35 ` Simon Wright [this message]
2002-06-04 13:04   ` Martin Dowie
2002-06-06  8:06     ` Simon Wright
2002-06-11  7:18 ` David Thompson
replies disabled

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