IEEE Std 754-2019 specifies the “Binary interchange floating-point formats” binary32, binary64, and binary128, while iso_fortran_env includes real32, real64, and real128.
It is not surprising that Fortran compilers do not necessarily implement realKaccording to binaryK (K = 32, 64, 128). Anyway, the Fortran standard does not talk about IEEE 754 at all.
For example,
real128ofnagfor7.2 has the “minimum exponent”mineponent(x)= -968 and the “maximum exponent”maxexponent(x)= 1023;binary128of IEEE has the “minimum exponent” emin = -16382 and the “maximum exponent” emax = 16383.
Note that they use the same terminology (minimum / maximum exponent) despite different notations. Nonetheless, there is no surprise. Nobody says real128 must be binary128.
However, I did not find out until today that the mathematical definition of [maxexponent(x), minexponent(x)] in Fortran standards indeed differs from that of [emin, emax] in IEEE 754 even for the same numeric model. See, e.g., Sec. 16.4 of J3/24-007 for the former and Sec. 3.3 of IEEE Std 754-2019 for the latter.
Given the same floating-point numeric model, it turns out that
For example, the implementations of real32 in gfortran, ifx, nagfor, flang, and nvfortran all seem to align with binary32, but
whereas
Of course, this is not a mathematical difference, but only a notational one. No big deal, nothing nontrivial, just different notations adopted by different documents, but it might be better to know.
