comp.lang.ada
 help / color / mirror / Atom feed
From: "Alexander Boucke" <alexb@lufmech.rwth-aachen.de>
Subject: How to catch NaNs with gnat3.14p
Date: Fri, 1 Feb 2002 14:49:56 +0100
Date: 2002-02-01T13:50:03+00:00	[thread overview]
Message-ID: <a3e6eb$2jt$1@nets3.rz.RWTH-Aachen.DE> (raw)

Hello!

One of the announced features of gnat3.14p is the ability to raise contraint
error, when NaN or Inf occures. But how to do it? I was not able to find
something about this in the documentation. And the following program just
behaves as with gnat3.13p:

with ada.text_io; use ada.text_io;
procedure nan is
   float1, float2 : float := 0.0;
   a_nan : float;
begin
   a_nan := float1/float2;
   if not a_nan'valid then
      put_line("A NaN occured " & a_nan'img);
   else
      put_line(a_nan'img);
   end if;
end nan;

compiling (gnatmake -gnato nan) yields the output:
> ./nan
A NaN occured NaN********
>

Did I miss something?

Regards,
Alexander





             reply	other threads:[~2002-02-01 13:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-01 13:49 Alexander Boucke [this message]
2002-02-01 14:18 ` How to catch NaNs with gnat3.14p Preben Randhol
2002-02-01 14:37   ` Alexander Boucke
2002-02-01 14:55     ` Preben Randhol
2002-02-01 14:59       ` Alexander Boucke
2002-02-01 15:30         ` Preben Randhol
2002-02-01 16:10           ` Alexander Boucke
2002-02-01 16:10             ` Jeffrey Creem
2002-02-02  6:23               ` Robert Dewar
2002-02-02  6:21     ` Robert Dewar
2002-02-04  8:57       ` Alexander Boucke
2002-02-02  6:20   ` Robert Dewar
2002-02-02 12:49     ` Preben Randhol
2002-02-02 22:56       ` Robert Dewar
2002-02-01 20:22 ` Robert Dewar
2002-02-03 13:27   ` Marc A. Criley
2002-02-03 23:06     ` Robert Dewar
2002-02-04 13:05       ` Marc A. Criley
2002-02-05  1:06         ` Robert Dewar
replies disabled

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