declares single precision pi without extraneous digits

The previous version had a line

real, parameter :: PI = 3.1415926535897931

that was misleading, since real variables are single precision by default in Fortran and will not store all the digits shown.
This commit is contained in:
Beliavsky 2024-11-10 07:15:01 -05:00 committed by GitHub
parent 77e2233bf3
commit 0a2e0e4aa5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,7 +41,7 @@ program example ! declare a program called example.
real :: v, x ! WARNING: default initial values are compiler dependent!
real :: a = 3, b = 2E12, c = 0.01
integer :: i, j, k = 1, m
real, parameter :: PI = 3.1415926535897931 ! declare a constant.
real, parameter :: PI = 3.14159265 ! declare a constant.
logical :: y = .TRUE., n = .FALSE. ! boolean type.
complex :: w = (0, 1) ! sqrt(-1)
character(len=3) :: month ! string of 3 characters.