comp.lang.ada
 help / color / mirror / Atom feed
* Help with fixed types...insufficient model numbers?
@ 1997-04-01  0:00 John Gluth
  1997-04-01  0:00 ` Robert Dewar
  1997-04-01  0:00 ` john schneider
  0 siblings, 2 replies; 4+ messages in thread
From: John Gluth @ 1997-04-01  0:00 UTC (permalink / raw)



Can somebody help me understand this model number thing?

I'm using the Rational Apex environment and compiling for 
a PowerPC 603e.

Basic problem:

I've got a 64 bit timer (running at 10 MHz)
I don't need 64 bits of resolution (1 ms is adequate).

I originally planned to use 32 bits of the timer, shifting left 
8 bits, leaving me with LSB = 25.6 microseconds, and a rollover 
time of around 8 hours.

So I tried doing this:

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;

This leads to a complaint from the compiler along the lines of 
'insufficient model numbers'

I did a little more research.  SAFE_SMALL is defined as 1.000000000E-04

As I understand it, SAFE_SMALL would indicate the smallest value for 
for 'Small that would give me enough model numbers to get the full
range of values (-2.0**31 .. 2.0**31 -1.0)...true?

I did a little experimenting, and found that if I use:

Time_LSB : constant := 1.0;     => No problem with 0..2.0 ** 31 - 1.0
Time_LSB : constant := 0.0001;  => Insufficient model numbers
                                   (even using 0..2.0**30, 2.0**29, etc.)
Time_LSB : constant := 0.1;     => Still insufficient model numbers
                                   down to 2.0**29, etc.

How does one determine what the maximum allowable range is?

There is an attribute LAST, which is listed as 214748.3647
Is this my upper limit?  If so, why?

What's the largets upper bound I can get with a 32 bit fixed number and
an LSB (Small) of around 1E-3?

Thanks,

John




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

end of thread, other threads:[~1997-04-02  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-04-01  0:00 Help with fixed types...insufficient model numbers? John Gluth
1997-04-01  0:00 ` Robert Dewar
1997-04-01  0:00 ` john schneider
1997-04-02  0:00   ` Robert Dewar

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