[PATCH] gfortran -- Map REAL128 to REAL kind type with widest precision

Jerry DeLisle jvdelisle@charter.net
Fri Feb 10 19:14:00 GMT 2017


On 02/09/2017 08:05 PM, Steve Kargl wrote:
> On Thu, Feb 09, 2017 at 07:35:11PM -0800, Jerry DeLisle wrote:
>> On 02/09/2017 12:40 PM, Janne Blomqvist wrote:
>>> On Thu, Feb 9, 2017 at 8:33 PM, Steve Kargl
>>> <sgk@troutmask.apl.washington.edu> wrote:
>>>> On Thu, Feb 09, 2017 at 12:10:02PM +0200, Janne Blomqvist wrote:
>>>>>
>>>>> That being said, I think even with Steve's patch, it's not guaranteed
>>>>> to give you IEEE 754-2008 binary128. E.g. on IBM POWER targets,
>>>>> depending on the ABI you may get an IBM extended double (double-double
>>>>> or __ibm128) format. Although if IEEE binary128 is also available,
>>>>> with Steve's patch you should get that one has it has more precision
>>>>> that __ibm128.
>>>>
>>>> I do not have to a IBM POWER system, so cannot easily check the
>>>> effect of my patch.
>>
>> On IBM Power
>>
>> program foo
>>     use iso_fortran_env
>>     REAL(REAL128) x
>>     print '(3(I0,1X))', kind(x), digits(x), precision(x)
>> end program foo
>>
>> $ gfc -static foo.f90
>> $ ./a.out
>> 16 106 31
>>
>
> That is the double-double format.  The gcc manual says that
> powerpc takes a -mfloat128 option (among others).  This will
> probably give you 16 113 33.
>

$ gfc -static -mfloat128 foo.f90
$ ./a.out
16 106 31






More information about the Fortran mailing list