[J3] IEEE supported formats?

Malcolm Cohen malcolm at nag-j.co.jp
Thu Jun 11 20:29:53 EDT 2020


Hi Steve,

 

The standard literally says “an ISO/IEC/IEEE 60559:2011 floating-point format”. There is no qualification there, so that means, “an ISO/IEC/IEEE 60559:2011 floating-point format”.

 

There is absolutely no doubt that 60559:2011 defines several basic formats, also interchange formats (a superset), and extended formats (additional). There is no doubt that these are all floating-point formats.

 

Therefore, I see no bug in gfortran here. 80-bit “double-extended” is a perfectly valid format according to 60559:2011 subclause 3.7.

 

No, the standard should not say “including extended formats”, as that would implicitly exclude any interchange format that is neither basic nor extended, viz binary16. The unqualified “format” is correct.

 

Cheers,

-- 

..............Malcolm Cohen, NAG Oxford/Tokyo.

 

From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Steven G. Kargl via J3
Sent: Friday, June 12, 2020 4:16 AM
To: J3 Fortran <j3 at mailman.j3-fortran.org>
Cc: Steven G. Kargl <kargl at troutmask.apl.washington.edu>
Subject: [J3] IEEE supported formats?

 

A bug has been reported with gfortran's IEEE support, but it is
unclear (to me) whether it is a compiler bug or a defect in the
Fortran standard.

On some architectures, gfortran supports 4 REAL kinds with a radix
of 2. For this discussion call these types REAL(4), REAL(8), REAL(10),
and REAL(16). The types with kind=4, 8, and 16 map to IEEE Std 754-2008's
binary32, binary64, and binary128 basic formats. REAL(10) maps to an
extended binary64 format (sometimes called extended double or Intel
80-bit format). This program

use ieee_arithmetic
print *, precision(1._4), selected_real_kind(6), ieee_selected_real_kind(6)
print *, precision(1._8), selected_real_kind(8), ieee_selected_real_kind(8)
print *, precision(1._10), selected_real_kind(16), ieee_selected_real_kind(16)
print *, precision(1._16), selected_real_kind(21), ieee_selected_real_kind(21)
end

outputs 

6 4 4
15 8 8
18 10 10
33 16 16

It is claimed, that for the 3rd line, gfortran's ieee_selected_real_kind(16)
should return 16. That is, it should select the binary128 basic format.

Is the intent of the Fortran standard to have Section 17 apply only to
the IEEE Std 754-2008's basic formats? If yes, should the Fortran standard
explicitly state this? If no, and extended formats can be supported by
a processor, should the Fortran standard state that extended formats 
are allowed. A search of the WD 1539-1 J3/18-007r1 did not turn up 
any restrictions of the supported format. I'll note that it is possible
that I missed the restrictions or in the absences of any restrictions
gfortran result conforms to the Fortran standard.

-- 
Steve



Disclaimer

The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. Please see our Privacy Notice <https://www.nag.co.uk/content/privacy-notice>  for information on how we process personal data and for details of how to stop or limit communications from us.

This e-mail has been scanned for all viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20200612/3f6ea868/attachment.htm>


More information about the J3 mailing list