comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <bauhaus@futureapps.invalid>
Subject: Re: getting same output as gfortran, long_float
Date: Fri, 01 May 2015 13:55:51 +0200
Date: 2015-05-01T13:55:51+02:00	[thread overview]
Message-ID: <mhvpi8$b8g$1@dont-email.me> (raw)
In-Reply-To: <mhu65r$ntj$1@speranza.aioe.org>

On 30.04.15 23:17, Nasser M. Abbasi wrote:
>
> How to obtain the last result above in Ada?

One option seems to be to use GNAT.SSE as a base, and then overload
operators "*" and the like. This should be good for computations,
not sure about I/O. The package SSE defines a type m128 providing for
SSE operations.

I don't know what the Fortran part of GCC does that the Ada part
couldn't also do, but maybe it's a matter of supply and demand,
supply following demand. As the work seems to have been done
for the Fortran part of GCC, wishful thinking might conclude that
adapting the work to the Ada part's requirements is a reasonably
inexpensive proposition, who knows?

Arbitrary precision might seem another option:
http://web.am.qub.ac.uk/users/j.parker/miscellany/arbitrary/README.arbitrary


The representations chosen by GNAT is seen when passing the switch -gnatRN
to the compiler. For example:

$ gnatmake -gnatwa -gnatR2 foof8.adb
gcc -c -gnatwa -gnatR3 foof8.adb

Representation information for unit Foof8 (body)
------------------------------------------------

for Real'Size use 64;
for Real'Alignment use 8;

for X'Size use 64;
for X'Alignment use 8;
gnatbind -x foof8.ali
gnatlink foof8.ali

Compilation finished at Fri May  1 13:50:13

Where

procedure Foof8
is
    Byte : constant := 8;

    type Real is new Long_Float;
    for Real'Size use 8 * Byte;
    
    --   Dmitry hinted at this:
    --   "If -fdefault-real-8 is given, DOUBLE PRECISION would instead
    --   be promoted to 16 bytes if possible".
    
--   type Double_Precision is digits Natural(112.0 * 0.3)
--   with
--     Size => 16 * Byte;
    
    X : Real;
begin
    X := 0.0;
    if X /= X then
       X := 1.0;
    end if;
end Foof8;


      parent reply	other threads:[~2015-05-01 11:55 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-30 21:17 getting same output as gfortran, long_float Nasser M. Abbasi
2015-04-30 22:08 ` Dmitry A. Kazakov
2015-04-30 22:11   ` Dmitry A. Kazakov
2015-04-30 22:37   ` Nasser M. Abbasi
2015-04-30 22:53     ` Nasser M. Abbasi
2015-05-01  7:22       ` Jacob Sparre Andersen
2015-05-01  1:12   ` Nasser M. Abbasi
2015-05-01  6:52     ` Dmitry A. Kazakov
2015-05-01  7:32       ` Nasser M. Abbasi
2015-05-01  7:45         ` Dmitry A. Kazakov
2015-05-04  0:15           ` robin.vowels
2015-05-04  7:21             ` Dmitry A. Kazakov
2015-05-04  8:53               ` robin.vowels
2015-05-04 10:18                 ` Dmitry A. Kazakov
2015-05-04 13:45                   ` robin.vowels
2015-05-04 14:47                     ` Dmitry A. Kazakov
2015-05-07  2:01                       ` robin.vowels
2015-05-01 23:24       ` Dennis Lee Bieber
2015-05-04  0:09       ` robin.vowels
2015-05-01  7:01     ` Dmitry A. Kazakov
2015-05-04  0:42     ` robin.vowels
2015-04-30 22:12 ` Jeffrey R. Carter
2015-04-30 22:27   ` Qun-Ying
2015-05-01  0:59     ` Dennis Lee Bieber
2015-04-30 22:32   ` Nasser M. Abbasi
2015-05-01  1:16     ` Jeffrey R. Carter
2015-05-01  1:40       ` Nasser M. Abbasi
2015-05-01  7:47         ` Jacob Sparre Andersen
2015-05-01 15:39         ` Waldek Hebisch
2015-05-01 17:27           ` Nasser M. Abbasi
2015-05-01 18:03             ` Nasser M. Abbasi
2015-05-04  0:51             ` robin.vowels
2015-05-04  0:47         ` robin.vowels
2015-05-01  8:21 ` Simon Wright
2015-05-01 11:55 ` Georg Bauhaus [this message]
replies disabled

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