comp.lang.ada
 help / color / mirror / Atom feed
* type declaration and storage requirements
@ 2002-06-02 21:21 Russ
  2002-06-02 23:54 ` martin.m.dowie
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Russ @ 2002-06-02 21:21 UTC (permalink / raw)


Ada allows me to specify the number of digits and the range of a
floating-point type, or the delta and range of a fixed-point type.
This gives more control than, say, C/C++, which only allows me to
specify single or double precision. What bothers me, however, is that
I apparently need to do some homework of my own to determine if my
declaration will require one or two words for storage (for a
particular word size).

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.

Also, suppose I specify one digit too many for single-word storage. I
presume I will get double-word storage and nearly double the precision
I asked for. If I then port the program to another machine with a
different word size, I may get less precision, which means that the
program may produce different results. Am I missing something here?

I guess Ada takes the view that storage requirements are secondary to
the application's actual precision requirements. That's certainly
valid to a point, I guess. But sometimes precision requirements are
not so precise themselves, and jumping from one to two words might be
undesirable, particularly if the type is to be used extensively.



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2002-06-11  7:18 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2002-06-04 13:04   ` Martin Dowie
2002-06-06  8:06     ` Simon Wright
2002-06-11  7:18 ` David Thompson

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