From: David W. Glessner <david_glessner@my-deja.com>
Subject: Assignment of small Float values
Date: 2000/04/17
Date: 2000-04-17T00:00:00+00:00 [thread overview]
Message-ID: <8dfm0q$8nr$1@nnrp1.deja.com> (raw)
Why does GNAT treat the non-zero constant as 0.0 in the assignment to
F1 in the following example? 32-bit IEEE floating-point should
support values down to around 10**-38 (and even down to 10**-45 or
so for subnormal numbers).
Note that Rational Apex Ada behaves as I expected.
Is there something in Ada that allows the assignment of 0.0 or is
this a GNAT bug?
-- Test program that shows unexplained (to me at least) GNAT behavior
for
-- floating point assignments.
--
-- GNAT 3.12p Win98 displays:
-- 0.00000E+00 <-- Why does GNAT display 0.0?
-- 6.66666666666667E-33
-- 6.66667E-33
--
-- Rational Apex 3.0.0b for Solaris (Sparc) displays:
-- 6.66667E-33
-- 6.66666666666667E-33
-- 6.66667E-33
with Ada.Text_Io;
procedure Test_Float_Range is
C : constant := 6.6666666666666666E-33;
F1 : Float := C;
F2 : Long_Float := C;
F3 : Float := Float (F2);
use Ada.Text_Io;
begin
Put_Line (Float'Image (F1));
Put_Line (Long_Float'Image (F2));
Put_Line (Float'Image (F3));
end Test_Float_Range;
Sent via Deja.com http://www.deja.com/
Before you buy.
next reply other threads:[~2000-04-17 0:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-04-17 0:00 David W. Glessner [this message]
2000-04-29 0:00 ` Assignment of small Float values swhalen
2000-04-30 0:00 ` Robert I. Eachus
2000-05-02 0:00 ` Disturbing float conversions jboulais
2000-05-02 0:00 ` JP Thornley
2000-05-11 0:00 ` jboulais
2000-05-13 0:00 ` JP Thornley
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox