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, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3f2ed3f93fdb688b,start X-Google-Attributes: gid103376,public From: David W. Glessner Subject: Assignment of small Float values Date: 2000/04/17 Message-ID: <8dfm0q$8nr$1@nnrp1.deja.com>#1/1 X-Deja-AN: 612334093 X-Http-Proxy: 1.0 x25.deja.com:80 (Squid/1.1.22) for client 205.175.225.5 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Mon Apr 17 18:43:43 2000 GMT X-MyDeja-Info: XMYDJUIDdavid_glessner Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.51 [en]C-CCK-MCD (Win95; U) Date: 2000-04-17T00:00:00+00:00 List-Id: 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.