[J3] IEEE supported formats?
Steven G. Kargl
kargl at troutmask.apl.washington.edu
Thu Jun 11 15:15:39 EDT 2020
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
More information about the J3
mailing list