comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <Stephen.Leake@gsfc.nasa.gov>
Subject: Re: Need exception despite Machine_Overflows is false
Date: 1998/12/18
Date: 1998-12-18T00:00:00+00:00	[thread overview]
Message-ID: <ug1ad8kyo.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 36796140.62B2788C@magic.fr

Pascal MALAISE <malaise@magic.fr> writes:

> Using gnat 3.10p on Linux,
> I make several computations on long_float (s), then use a
> text_io.float_io
> to display the results => NaN*****
> 
> There is an overflow, Gnat uses the libc, long_float'Machine_Overflows
> is false...
> fair enough.
> 
> What can I do to get a constraint_error raised when there is an
> overflow?
> Don't tell me that I have to check, via an interface to C finite(), the
> result of
> each operation!

You could try adding a range constraint to your basic floating point type:

type Real is digits 9 range -1.0e307 .. +1.0e307;

As long as your limits are tighter than the machine limits, the
compiler will insert explicit checks. Of course, this will slow things
down, but I assume you could remove the limits after you find the bug.

This is one reason not to use the predefined Float type!

-- Stephe
> 
> -- 
> Pascal MALAISE
> (priv) mailto:malaise@magic.fr
> (prof) mailto:malaise@fr.airsysatm.thomson-csf.com




  parent reply	other threads:[~1998-12-18  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-17  0:00 Need exception despite Machine_Overflows is false Pascal MALAISE
1998-12-17  0:00 ` Matthew Heaney
1998-12-18  0:00   ` dewarr
1998-12-18  0:00     ` Matthew Heaney
1998-12-19  0:00       ` dewar
1998-12-18  0:00 ` Stephen Leake [this message]
1998-12-18  0:00   ` Matthew Heaney
1998-12-18  0:00   ` Pascal MALAISE
1998-12-19  0:00     ` dewarr
replies disabled

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