[PATCH] gfortran -- Map REAL128 to REAL kind type with widest precision
Jerry DeLisle
jvdelisle@charter.net
Sat Feb 11 00:52:00 GMT 2017
On 02/10/2017 11:22 AM, Janne Blomqvist wrote:
> On Fri, Feb 10, 2017 at 9:14 PM, Jerry DeLisle <jvdelisle@charter.net> wrote:
>> 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
>
> Hmm, fascinating. What about
>
> -mfloat128 -mcpu=power9
> -mfloat128 -mabi=ieeelongdouble
> -mfloat128 -mcpu=power9 -mabi=ieeelongdouble
>
gcc112 is a power8 machine.
$ gfc -static -mfloat128 -mcpu=power8 foo.f90
$ ./a.out
16 106 31
$ gfc -static -mfloat128 -mabi=ieeelongdouble foo.f90
gfc: warning: using IEEE extended precision long double
f951: Warning: using IEEE extended precision long double
$ ./a.out
16 113 33
$ gfc -static -mfloat128 -mcpu=power8 -mabi=ieeelongdouble foo.f90
gfc: warning: using IEEE extended precision long double
f951: Warning: using IEEE extended precision long double
$ ./a.out
16 113 33
More information about the Fortran
mailing list