! This file: ! http://ftp.aset.psu.edu/pub/ger/fortran/hdk/DPKindExample.f90 ! program double2 ! Examples of the proper way to declare REAL variables and ! constants to be Double Precision or Single Precision ! F-Compiler compatible. ! ! Set IEEE Double Precision integer, parameter :: PREC = selected_real_kind(15) ! ! Set IEEE Single Precision ! integer, parameter :: PREC = selected_real_kind(6) real(kind=PREC) :: var1, var2 real(kind=PREC) :: dt=1.0e-4_PREC ! Note: the kind parameter PREC may have any valid name. print *, Huge(var1) print *, Tiny(var2) print *, "Single Precision constant 1/3: ",1.0/3.0 print *, "Double Precision constant 1/3: ",1.0_PREC/3.0_PREC print *, "dt=",dt end program double2