-
Notifications
You must be signed in to change notification settings - Fork 0
Best practices
Mauricio Esguerra edited this page May 14, 2015
·
3 revisions
The program should work as double precision (or custom precision). There is no place to give a choice to the compiler. When you write code you must know what precision it should be, that is why we need to use the following rules:
-
no default declarations of real. Use parameter for:
- single precision
real(kind=singleprecision) - double/custom precision
real(kind=prec)
- single precision
-
function real should contain precision
- single precision
real(variable/formula, kind=singleprecision) - double/custom precision
real(variable/formula, kind=prec)
- single precision
-
numerical values should contain information about precision
- single precision e.g.
1.0_singleprecision0.0_singleprecision1.e-12_singleprecision - double/custom precision e.g.
1.0_prec0.0_prec1.e-12_prec
- single precision e.g.
-
if you need use different precision than used in program add it in size.f90 file and use it as previous examples
-
math functions sin(), cos(), asin() etc. are in default precision. Use compiler flags for single or double precision as default
gfortran -fdefault-real-8
ifort -r8pgf90 -r8
- in md.f90 are defined one and zero use them in that file:
real(kind=prec) :: one = 1.0_precreal(kind=prec) :: zero = 0.0_prec
###Development
###Milestones