Real literal suffix

Fortran uses d0 and q0 as double and quadruple precision real literal suffixes, respectively. Will Fortran run out of letters to use as real literal suffixes if we have more precisions available in the future?

It’s going to get confusing if we get to octuple precision and start suffixing reals with o0 :grin:

I only use d0 to define a kind, as in

wp = kind(1.0d0)

Then I will write 3.2_wp instead of 3.2d0, since having hard-coded kinds sprinkled throughout a program makes it more difficult to change the kind used.

@fortran4r , note though with literal constants of REAL type in Fortran, it is better in practice to restrict the use of “eN” toward enabling the “power of” scaling to cases involving nonzero N only. With E0, it’s superfluous: 1.23_knd is adequate for the purposes.

No it doesn’t. d0, yes. q0 is an extension. The “modern Fortran” way is to use kind numbers. See also Doctor Fortran in “It Takes All KINDs” - Doctor Fortran (stevelionel.com)

1 Like