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.4 required=5.0 tests=BAYES_00,PDS_BTC_ID autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1525d71e3169ed06 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Float precision - gnat vs objectada Date: Thu, 2 Dec 2004 09:32:41 +0100 Message-ID: <67y3zzucp3e1.uomux6epm0zs$.dlg@40tude.net> References: <1c8dc73c.0412010746.272b978@posting.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: individual.net M4oJWvlBsgk8b2xvTxPc0gZbENsOi/Be4/7V3JSmZmA6hXQ6M= User-Agent: 40tude_Dialog/2.0.12.1 Xref: g2news1.google.com comp.lang.ada:6711 Date: 2004-12-02T09:32:41+01:00 List-Id: On 1 Dec 2004 07:46:38 -0800, P Torle wrote: > I'm working on a Ada95/C project that shall run on both Linux and > Windows. > I have some problems getting the same float precision on both > platforms. To get the same precision tell the compiler which one you need. type My_Float is digits N; > Example: > ----------------------------- > subtype Real is Long_Float; > pi : Real; > > pi := 3.14159_26535_89793_23846_26433_83279_50288_41971_69399_37511; > Real_Io.Put(pi, Aft => 25); > ----------------------------- > > Results: > Linux: 3.1415926535897931200000000E+00 > Win32: 3.1415926535897931159979634E+00 > > The thing is, the following float-precision definitions are equal on > both Linux and Windows: > > Real'Machine_Mantissa : 53 > Real'Machine_Emin : -1021 > Real'Machine_Emax : 1024 > Real'Digits : 15 > > So why the difference? Probably because the implementations of Real_IO.Put are slightly different. But anything after 3.14159_26535_8979 is just a noise. The problem is not whether Long_Floats are different or not. The problem is that Aft=>25 > T'Digits. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de