NLSL: rnddbl.f90 Source File

NLSL

- Main Page
- Modules
- Data Types List
- Files

- File List
- File Members

rnddbl.f90
Go to the documentation of this file.
1 c NLSL Version 1.9.0 beta 2/13/15
2 c*********************************************************************
3 c =========================
4 c module RNDDBL
5 c =========================
6 c
7 c Declarations of the machine epsilon parameter, and the
8 c highest and lowest representable double precision values
9 c
10 c Notes:
11 c 1) The machine epsilon, eps, is defined to be the
12 c largest number such that the result of the
13 c expression
14 c
15 c delta=(1.0D0+eps)-1.0D0
16 c
17 c returns the value delta=0.0D0. In other words,
18 c 1.0D0+eps is smallest double precision floating
19 c point number greater than 1.0D0.
20 c
21 c 2) A FORTRAN 77 program to determine the machine
22 c epsilon is included below for completeness.
23 c This program should be compiled with all
24 c compiler optimization disabled. The parameter
25 c rndoff declared in this file should assigned to
26 c be a small multiple of the larger of the two
27 c numbers printed by this program. This program
28 c is an adaptation of the function subroutine epslon
29 c supplied with EISPACK.
30 c
31 c 3) On most DEC machines, the two methods of
32 c calculating the machine epsilon give the nearly
33 c same the result, eps=2.77555756D-17. An
34 c appropriate value of rndoff is then 1.0D-16. An
35 c example of a machine which gives grossly
36 c different results is the Prime 9955.
37 c
38 c 4) ANSI-compliant C compilers provide these values
39 c in the header file "float.h".
40 c
41 c written by DJS 11-SEP-87
42 c updated for IEEE754 by WH 13-FEB-2002
43 c
44 c*********************************************************************
45 c
46 c program meps
47 c
48 c double precision a,b,c,eps
49 c
50 c#######################################################################
51 c
52 c a=1.0D0
53 c10 b=a+1.0D0
54 c eps=c
55 c c=b-1.0D0
56 c if (c.eq.0.0D0) go to 20
57 c a=a/2.0D0
58 c go to 10
59 c
60 c20 write (*,*) 'first epsilon = ',eps
61 c
62 c a=4.0D0/3.0D0
63 c30 b=a-1.0D0
64 c c=b+b+b
65 c eps=dabs(c-1.0D0)
66 c if (d.eq.0.0D0) go to 30
67 c
68 c write (*,*) 'second epsilon = ',eps
69 c
70 c stop
71 c end
72 c
73 c***********************************************************************
74 c
75 c The values provided below are for IEEE754 double precision.
76 c
77 module rnddbl
78 implicit none
79 c
80 double precision, parameter ::
81 # dbl_epsilon=2.2204460492503131d-16,
82 # dbl_min=2.2250738585072014d-308,
83 # dbl_max=1.7976931348623157d+308
84
85 c The following is an alternative name.
86 double precision, parameter :: rndoff=dbl_epsilon
87 c
88 end module rnddbl
rnddbl::dbl_max
double precision, parameter dbl_max
Definition: rnddbl.f90:80
rnddbl::dbl_min
double precision, parameter dbl_min
Definition: rnddbl.f90:80
rnddbl::dbl_epsilon
double precision, parameter dbl_epsilon
Definition: rnddbl.f90:80
rnddbl
Definition: rnddbl.f90:77
rnddbl::rndoff
double precision, parameter rndoff
Definition: rnddbl.f90:86