PRECISION

!REAL* and double precision program
!Program name: PRECISION

real, parameter :: a=1.12345678901234567890
!real or real*4 has 7 decimal places
double precision :: b,c
real*8 d,e

!real*8 or double precision have 16 decimal places
!real*8 has single precision with 16 decimal places
!double precision has DOUBLE PRECISION when there is d0

real*16 f,g
b=1.12345678901234567890d0
c=1.12345678901234567890
d=1.12345678901234567890
e=1.12345678901234567890d0
f=1.12345678901234567890
g=1.12345678901234567890d0

print *, a      !shows 1.1234568           (single precision)
print *, b     !shows 1.1234567890123457  (double precision)
print *, c      !shows 1.1234568357467651  (single precision)
print *, d      !shows 1.1234568357467651  (single precision)
print *, e      !shows 1.1234567890123457  (double precision)
print *, f
!shows 1.1234568357467651367187500000000000  (single precision)
print *, g
!shows 1.1234567890123456912476740399142727   (double precision)

stop
end

Comentários

Postagens mais visitadas deste blog

RECURSIVE

HYDROGEN-RADIAL

RUNGE-KUTTA