comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: S'Is_nan or S'Is_inf?
Date: Sat, 17 Jul 2010 09:40:23 +0200
Date: 2010-07-17T09:40:23+02:00	[thread overview]
Message-ID: <5xj0ja9xywto$.3ncqua6onpoa.dlg@40tude.net> (raw)
In-Reply-To: Xns9DB7BD155A072WarrensBlatherings@81.169.183.62

On Fri, 16 Jul 2010 22:35:14 +0000 (UTC), Warren wrote:

> I'll need
> to test it on other platforms, but hopefully most if not all
> IEEE platforms will support this.

IEEE representations have more than +Inf, -Inf and NaN. There are  other
objects: +0, -0, denormalized numbers (see attribute 'Denorm). Some have
dubious semantics:

with Ada.Text_IO;  use Ada.Text_IO;
procedure IEEE_Zeros is
   Zero : Float := 0.0;
   N0   : Float := 0.0 / (-1.0 / Zero);
begin
   Put_Line ("-0 =" & Float'Image (N0) & " 0 = " & Float'Image (Zero));
   Put_Line ("-0 = 0 " & Boolean'Image (N0 = Zero));
   Put_Line ("-0 < 0 " & Boolean'Image (N0 < Zero));
end IEEE_Zeros;

Negative zero is zero but not equal to, etc.

What are you trying to achieve? Because in automation we have the rule
never ever let IEEE cripples slip through. Don't read them, don't write
them, don't compute them.

The solution Simon suggested is basically everything Ada programmer should
know about IEEE 754! (:-))

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  parent reply	other threads:[~2010-07-17  7:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-15 21:00 S'Is_nan or S'Is_inf? Warren
2010-07-15 21:30 ` Rod Chapman
2010-07-15 22:03   ` Simon Wright
2010-07-15 21:42 ` J-P. Rosen
2010-07-15 22:07 ` Simon Wright
2010-07-16  8:42   ` Dmitry A. Kazakov
2010-07-16 17:06     ` Warren
2010-07-16 19:39       ` Dmitry A. Kazakov
2010-07-16 22:35     ` Warren
2010-07-17  6:24       ` Simon Wright
2010-07-19 17:04         ` Warren
2010-07-17  7:40       ` Dmitry A. Kazakov [this message]
2010-07-19 17:18         ` Warren
2010-07-19 23:15 ` Randy Brukardt
2010-07-20 14:12   ` Warren
2010-07-20 16:20     ` Dmitry A. Kazakov
replies disabled

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