Remix.run Logo
classified 2 days ago

What language is that, and what does `0.25_dp` mean?

pklausler 2 days ago | parent | next [-]

Fortran’s types have kinds, which are integer codes that further distinguish various flavors of each type. The ISO standard failed to define their meanings for the built-in types, but with any modern compiler worth using the kind values are the byte sizes. Literal constants can have a kind value as a suffix, and the suffix can be either an integer or a named constant. Fortran codes tend to establish named constants for the “working precision” kind and the next higher precision kind, so that one need only redefine those to compile various versions of a subroutine that work with different precisions.

Even when one isn’t defining named constants for various kinds, it’s still good practice to use them on literal floating constants, since those default to the default kind of REAL in Fortran, not to double precision as in most later languages. A very pernicious pitfall of the language is to (say) assign or initialize X=0.1 instead of X=0.1_8 when X is double precision.

loiseaujc a day ago | parent | prev | next [-]

Author here. It is Fortran indeed, but there is nothing specific to Fortran in what I discuss. Had you written the kernel in C or C++, you'd run in exactly the same problems.

chrystalkey 2 days ago | parent | prev | next [-]

I wondered the same thing. _dp might mean double precision, but the rest is beyond me

2 days ago | parent | prev | next [-]
[deleted]
zokier 2 days ago | parent | prev [-]

Fortran