076. Use d0 or _kind to make a constant double precision.#
topic: Data types
Note
This tip is a draft1.
Use d0 or _kind to make a constant double precision. Merely having many decimal places in a literal constant does not do so.
real(kind(1.0d0)) :: pi pi = 3.14159265358979323846 ! RHS is single precision
probably does not do what the programmer intends!
Use d0 or _kind to make a constant double precision. Merely having many decimal places in a literal constant does not do so.
— FortranTip (@fortrantip) January 5, 2022
real(kind(1.0d0)) :: pi
pi = 3.14159265358979323846 ! RHS is single precision
probably does not do what the programmer intends! pic.twitter.com/T9hNCwfcE2
- 1
From the perspective of FortranTip Browser, “draft” means that it hasn’t been edited for formatting, hasn’t had corresponding Fortran programs added, the text content hasn’t been enhanced, etc. Draft texts are extracted from the corresponding Tweet using the Twitter API.