41 real(
double),
intent(in) :: x1,x2
46 if(abs(xsum).gt.tiny(xsum))
then
47 reldiff = xdiff / (xsum*0.5_dbl)
49 if(abs(xdiff).gt.tiny(xdiff))
then
69 real,
intent(in) :: x1,x2
89 elemental function deq(x1,x2, eps)
93 real(
double),
intent(in) :: x1,x2
94 real(
double),
intent(in),
optional :: eps
99 if(
present(eps)) leps = max(leps, abs(eps))
101 if(abs(x1-x2).le.leps)
then
89 elemental function deq(x1,x2, eps)
…
117 elemental function deq0(x0, eps)
121 real(
double),
intent(in) :: x0
122 real(
double),
intent(in),
optional :: eps
127 if(
present(eps)) leps = max(leps, abs(eps))
129 if(abs(x0).le.leps)
then
147 elemental function seq(x1,x2, eps)
149 real,
intent(in) :: x1,x2
150 real,
intent(in),
optional :: eps
155 if(
present(eps)) leps = max(leps, abs(eps))
157 if(abs(x1-x2).le.leps)
then
147 elemental function seq(x1,x2, eps)
…
173 elemental function seq0(x0, eps)
175 real,
intent(in) :: x0
176 real,
intent(in),
optional :: eps
181 if(
present(eps)) leps = max(leps, abs(eps))
183 if(abs(x0).le.leps)
then
201 elemental function dne(x1,x2, eps)
204 real(
double),
intent(in) :: x1,x2
205 real(
double),
intent(in),
optional :: eps
208 if(
present(eps))
then
209 dne = .not.
deq(x1,x2, eps)
201 elemental function dne(x1,x2, eps)
…
223 elemental function dne0(x0, eps)
226 real(
double),
intent(in) :: x0
227 real(
double),
intent(in),
optional :: eps
230 if(
present(eps))
then
248 elemental function sne(x1,x2, eps)
250 real,
intent(in) :: x1,x2
251 real,
intent(in),
optional :: eps
254 if(
present(eps))
then
255 sne = .not.
seq(x1,x2, eps)
248 elemental function sne(x1,x2, eps)
…
270 elemental function sne0(x0, eps)
272 real,
intent(in) :: x0
273 real,
intent(in),
optional :: eps
276 if(
present(eps))
then
298 real(
double),
intent(in) :: x0
301 isinf = x0.gt.huge(x0) .or. x0.lt.-huge(x0)
313 real,
intent(in) :: x0
316 sisinf = x0.gt.huge(x0) .or. x0.lt.-huge(x0)
330 real(
double),
intent(in) :: x0
333 isanan = .not. (x0.le.x0 .or. x0.ge.x0)
345 real,
intent(in) :: x0
348 sisanan = .not. (x0.le.x0 .or. x0.ge.x0)
362 real(
double),
intent(in) :: x0
377 real,
intent(in) :: x0
404 pure subroutine plot_ranges(plx,ply, ddx,ddy, xmin,xmax, ymin,ymax, dx,dy)
408 real(
double),
intent(in) :: plx(:),ply(:), ddx,ddy
409 real(
double),
intent(out) :: xmin,xmax, ymin,ymax
410 real(
double),
intent(out),
optional :: dx,dy
416 if(
deq(xmin,xmax))
then
417 xmin = xmin * (1.d0-ddx)
418 xmax = xmax * (1.d0+ddx)
421 xmin = xmin - dx1*ddx
422 xmax = xmax + dx1*ddx
429 if(
deq(ymin,ymax))
then
430 ymin = ymin * (1.d0-ddy)
431 ymax = ymax * (1.d0+ddy)
434 ymin = ymin - dy1*ddy
435 ymax = ymax + dy1*ddy
439 if(
present(dx)) dx = xmax - xmin
440 if(
present(dy)) dy = ymax - ymin
404 pure subroutine plot_ranges(plx,ply, ddx,ddy, xmin,xmax, ymin,ymax, dx,dy)
…
457 elemental function mod1(number, period)
459 integer,
intent(in) :: number, period
462 mod1 = mod(number-1+period, period) + 1
457 elemental function mod1(number, period)
…
482 integer,
intent(in) :: a, b
483 integer ::
gcd2, la,lb,rem
485 if(min(a,b).le.0)
call quit_program_error(
'gcd2(): the two integers must be positive ',1)
491 if(la.lt.lb)
call swapint(la,lb)
522 integer,
intent(in) :: array(:)
525 if(minval(array).le.0)
call quit_program_error(
'gcd(): all integers must be positive ',1)
547 integer,
intent(in) :: array(:)
548 integer ::
lcm, larray(size(array)), in
550 if(minval(array).le.0)
call quit_program_error(
'lcm(): all integers must be positive ',1)
554 if(minval(larray).eq.maxval(larray))
exit
556 in = minval(minloc(larray))
557 larray(in) = larray(in) + array(in)
Provides kinds and related constants/routines.
integer, parameter double
Double-precision float. Precision = 15, range = 307.
integer, parameter dbl
Double-precision float. Precision = 15, range = 307.
Procedures for numerical operations.
elemental logical function seq0(x0, eps)
Test whether a single-precision variable ais equal to zero better than a given value (default: 2x mac...
elemental logical function dne(x1, x2, eps)
Test whether two double-precision variables are unequal to better than a given value (default: 2x mac...
elemental logical function seq(x1, x2, eps)
Test whether two single-precision variables are equal to better than a given value (default: 2x machi...
elemental logical function isnormal(x0)
Test whether a double-precision variable is normal (not +/- Inf, not NaN)
elemental integer function mod1(number, period)
A modulo function to wrap array indices properly in Fortran ([1,N], rather than [0,...
elemental real(double) function reldiff(x1, x2)
Return the relative difference between two numbers: dx/<x> - double precision.
elemental logical function sisanan(x0)
Test whether a single-precision variable is not a number (NaN)
elemental logical function sisnormal(x0)
Test whether a single-precision variable is normal (not +/- Inf, not NaN)
elemental logical function isanan(x0)
Test whether a double-precision variable is not a number (NaN)
integer function gcd2(a, b)
Compute the greatest common divisor (GCD) of two positive integers using the Euclidean algoritm.
elemental logical function dne0(x0, eps)
Test whether a double-precision variable is unequal to zero better than a given value (default: 2x ma...
elemental logical function deq0(x0, eps)
Test whether a double-precision variable is equal to zero better than a given value (default: 2x mach...
elemental logical function sisinf(x0)
Test whether a single-precision variable is (+/-) infinite.
elemental logical function isinf(x0)
Test whether a double-precision variable is (+/-) infinite.
elemental logical function sne(x1, x2, eps)
Test whether two single-precision variables are unequal to better than a given value (default: 2x mac...
pure subroutine plot_ranges(plx, ply, ddx, ddy, xmin, xmax, ymin, ymax, dx, dy)
Determine plot ranges from data arrays in x and y, and relative margins.
elemental logical function deq(x1, x2, eps)
Test whether two double-precision variables are equal to better than a given value (default: 2x machi...
elemental real function reldiff_sp(x1, x2)
Return the relative difference between two numbers: dx/<x> - single precision version.
elemental logical function sne0(x0, eps)
Test whether a single-precision variable is unequal to zero better than a given value (default: 2x ma...
integer function lcm(array)
Computes the least common multiplier (LCM) for an array of positive integers.
integer function gcd(array)
Computes the greatest common divisor (GCD) for an array of positive integers using the Euclidean algo...
System-related procedures.
subroutine quit_program_error(message, status)
Print an error message to StdErr and stop the execution of the current program.
pure subroutine swapint(int1, int2)
Swap two integer variables.