comp.lang.ada
 help / color / mirror / Atom feed
From: Qun-Ying <zhu.qunying@gmail.com>
Subject: Re: getting same output as gfortran, long_float
Date: Thu, 30 Apr 2015 15:27:43 -0700
Date: 2015-04-30T15:27:43-07:00	[thread overview]
Message-ID: <mhua7t$1eo$1@speranza.aioe.org> (raw)
In-Reply-To: mhu9bb$lc2$1@dont-email.me

Currently, on my x86_64 Linux with GCC 4.9.2, the maximum digits I could 
define is 18:
type My_float is digits 18;

Far less then what you would expected.

You would need to use some bindings to MPFR/GMP library for more precisions.

Jeffrey R. Carter wrote:
> On 04/30/2015 02:17 PM, Nasser M. Abbasi wrote:
>>
>> with ada.text_io; use ada.text_io;
>> procedure foo_2 is
>>    x : Long_Long_Float;
>> begin
>>    x := 12.0 * 0.0001/(1.0 * (1.0 - 0.1)**4 );
>>    put_line(Long_Long_Float'image(x));
>> end foo_2;
>
> What do you get with this:
>
> With Ada.Text_IO;
> procedure Foo_However_Many is
>     X : constant := 12.0 * 0.0001 / (1.0 * (1.0 - 0.1) ** 4);
> begin -- Foo_However_Many
>     Ada.Text_IO.Put_Line (Item => X'Img);
> end Foo_However_Many;
>
> ? You probably can't get any more significant digits from GNAT than this gives
> you. You could also try a type defined as
>
> type Big is digits System.Max_Digits;
>

  reply	other threads:[~2015-04-30 22:27 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 [this message]
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
replies disabled

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