PRECISION2

 !program real_kinds and double precision

!program  name:PRECISION2

 

  integer,parameter :: p6 = selected_real_kind(6)

  integer,parameter :: p10r100 = selected_real_kind(10,100)

  integer,parameter :: p13r200 = selected_real_kind(13,200)

  integer,parameter :: r400 = selected_real_kind(r=400)

  integer,parameter :: dp = selected_real_kind(15,307)

  integer,parameter :: sp = selected_real_kind(6,37)

  integer,parameter :: dp2 = selected_real_kind(15,307)

  double precision :: e,f

 

  real(kind=p6) :: x

  real(kind=p10r100) :: y

  real(kind=r400) :: z

  real(kind=p13r200) :: w

  real(kind=dp) :: a

  real(kind=sp) :: b

  real(kind=dp2) :: c,d

  a=1.12345678901234567890

  b=1.12345678901234567890

  c=1.12345678901234567890_dp

  d=1.12345678901234567890d0

  e=1.12345678901234567890d0

  f=1.12345678901234567890_dp

 

  print *, precision(x), range(x)  !shows   6   37

  print *, precision(y), range(y)  !shows   15  307

  print *, precision(w), range(w)  !shows   15  307

  print *, precision(z), range(z)  !shows   18  4931

  print *, a    !shows 1.1234568357467651  (single precision)

  print *, b    !shows 1.1234568

  print *, c    !shows 1.1234567890123457 (double precision)

  print *, d    !shows 1.1234567890123457 (double precision)

  print *, e    !shows 1.1234567890123457 (double precision)

  print *, f    !shows 1.1234567890123457 (double precision)

  stop

  end

Comentários

Postagens mais visitadas deste blog

RECURSIVE

HYDROGEN-RADIAL

RUNGE-KUTTA