[skip ci] more general names and procedure

This commit is contained in:
Martin Diehl 2019-03-07 11:02:27 +01:00
parent ccb62da24a
commit 7a083c4098
1 changed files with 8 additions and 8 deletions

View File

@ -79,8 +79,8 @@ module prec
integer(pInt), pointer, dimension(:,:) :: p integer(pInt), pointer, dimension(:,:) :: p
end type end type
real(pReal), private, parameter :: DBL_EPSILON = 2.220446049250313E-16_pReal !< minimum positive number such that 1.0 + DBL_EPSILON /= 1.0. real(pReal), private, parameter :: PREAL_EPSILON = epsilon(0.0_pReal) !< minimum positive number such that 1.0 + EPSILON /= 1.0.
real(pReal), private, parameter :: DBL_MIN = 2.2250738585072014E-308_pReal !< smallest normalized floating point number real(pReal), private, parameter :: PREAL_MIN = tiny(0.0_pReal) !< smallest normalized floating point number
public :: & public :: &
prec_init, & prec_init, &
@ -136,7 +136,7 @@ logical elemental pure function dEq(a,b,tol)
if (present(tol)) then if (present(tol)) then
eps = tol eps = tol
else else
eps = DBL_EPSILON * maxval(abs([a,b])) eps = PREAL_EPSILON * maxval(abs([a,b]))
endif endif
dEq = merge(.True.,.False.,abs(a-b) < eps) dEq = merge(.True.,.False.,abs(a-b) < eps)
@ -160,7 +160,7 @@ logical elemental pure function dNeq(a,b,tol)
if (present(tol)) then if (present(tol)) then
eps = tol eps = tol
else else
eps = DBL_EPSILON * maxval(abs([a,b])) eps = PREAL_EPSILON * maxval(abs([a,b]))
endif endif
dNeq = merge(.False.,.True.,abs(a-b) <= eps) dNeq = merge(.False.,.True.,abs(a-b) <= eps)
@ -184,7 +184,7 @@ logical elemental pure function dEq0(a,tol)
if (present(tol)) then if (present(tol)) then
eps = tol eps = tol
else else
eps = DBL_MIN * 10.0_pReal eps = PREAL_MIN * 10.0_pReal
endif endif
dEq0 = merge(.True.,.False.,abs(a) < eps) dEq0 = merge(.True.,.False.,abs(a) < eps)
@ -208,7 +208,7 @@ logical elemental pure function dNeq0(a,tol)
if (present(tol)) then if (present(tol)) then
eps = tol eps = tol
else else
eps = DBL_MIN * 10.0_pReal eps = PREAL_MIN * 10.0_pReal
endif endif
dNeq0 = merge(.False.,.True.,abs(a) <= eps) dNeq0 = merge(.False.,.True.,abs(a) <= eps)
@ -233,7 +233,7 @@ logical elemental pure function cEq(a,b,tol)
if (present(tol)) then if (present(tol)) then
eps = tol eps = tol
else else
eps = DBL_EPSILON * maxval(abs([a,b])) eps = PREAL_EPSILON * maxval(abs([a,b]))
endif endif
cEq = merge(.True.,.False.,abs(a-b) < eps) cEq = merge(.True.,.False.,abs(a-b) < eps)
@ -258,7 +258,7 @@ logical elemental pure function cNeq(a,b,tol)
if (present(tol)) then if (present(tol)) then
eps = tol eps = tol
else else
eps = DBL_EPSILON * maxval(abs([a,b])) eps = PREAL_EPSILON * maxval(abs([a,b]))
endif endif
cNeq = merge(.False.,.True.,abs(a-b) <= eps) cNeq = merge(.False.,.True.,abs(a-b) <= eps)