From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Help with fixed types...insufficient model numbers?
Date: 1997/04/01
Date: 1997-04-01T00:00:00+00:00 [thread overview]
Message-ID: <dewar.859934543@merv> (raw)
In-Reply-To: 5hrdic$sr@hacgate2.hac.com
John Gluth asks about
<<Time_LSB : constant := 0.0000256;
type Time_Type is delta Time_LSB range 0.0 .. 2.0**31 - 1.0;
for Time_Type'Size use 32;
for Time_Type'Small use Time_LSB;>>
There is no model number subtlety here, just a plain obviously wrong
declaration. 32 bits would be enough to fit the given range (just, with
one bit to spare) if the delta were 1.0. Obviously with a delta of
0.0000256 you need far more bits. If you feed this to GNAT, you get:
1. package j is
2. Time_LSB : constant := 0.0000256;
3. type Time_Type is delta Time_LSB range 0.0 .. 2.0**31 - 1.0;
4. for Time_Type'Size use 32;
|
>>> size given (32) for type "Time_Type" too small, minimum is 47
5. for Time_Type'Small use Time_LSB;
6. end;
which seems obviously right for storing numbers in the range you give
with the least significant bit you give. It is not clear why this is
puzzling, so I can't figure out more to say ...
prev parent reply other threads:[~1997-04-01 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-04-01 0:00 Help with fixed types...insufficient model numbers? John Gluth
1997-04-01 0:00 ` john schneider
1997-04-02 0:00 ` Robert Dewar
1997-04-01 0:00 ` Robert Dewar [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox