From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,17506301c0751a38 X-Google-Attributes: gid103376,public From: Stephen Leake Subject: Re: Need exception despite Machine_Overflows is false Date: 1998/12/18 Message-ID: #1/1 X-Deja-AN: 423656786 References: <36796140.62B2788C@magic.fr> Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA Newsgroups: comp.lang.ada Date: 1998-12-18T00:00:00+00:00 List-Id: Pascal MALAISE 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