Statistics
| Branch: | Revision:

root / synthbench / euroben-dm / mod2a / .svn / text-base / dmacdp.f.svn-base @ 0:839f52ef7657

History | View | Annotate | Download (4 kB)

1
      Function dmacdp( i )               Result( mpar )
2
      Use        numerics
3
      Integer  :: i
4
      Real(l_) :: mpar
5
! --------------------------------------------------------------------
6
! --- This function provides 8-byte precision machine parameters.
7
!     The Fortran 90 intrisics are employed to get the relevant
8
!     parameters.
9
!
10
! --- A reference to dmacdp(i) produces one of the machine parameters
11
!     where:
12
!
13
!     I is an integer input variable in the range [1,...,6] which
14
!         selects the desired machine parameter. If the machine has
15
!         T base B digits and its smallest and largest exponents are
16
!         EMIN and EMAX, respectively, then these parameters are:
17
!
18
!         dmacdp(1) = B**(1 - T), the relative machine precision 
19
!                                 (RELEPS), at 1.0D0
20
!         dmacdp(2) = B**(EMIN - 1), the smallest representable Real
21
!                                    number (RMIN),
22
!         dmacdp(3) = B**EMAX*(1 - B**(-T)), the largest representable
23
!                                            Real number (RMAX).
24
!         dmacdp(4) = T, N.B.: T is returned as a Real (Double 
25
!                              Precision) value (due to the restric-
26
!                              tions of Fortran functions). It 
27
!                              should be converted to type Integer
28
!                              after the function call to avoid
29
!                              type conflicts.
30
!         dmacdp(5) = B, N.B.: B is returned as a Real (Double 
31
!                              Precision) value (due to the restric-
32
!                              tions of Fortran functions). It 
33
!                              should be converted to type Integer
34
!                              after the function call to avoid
35
!                              type conflicts.
36
!         dmacdp(6) = P, N.B.: P is is the length in bits of the
37
!                              floating-point numbers used in the
38
!                              benchmark.
39
!                              It is returned as a Real (Double 
40
!                              Precision) value (due to the restric-
41
!                              tions of Fortran-77 functions). It 
42
!                              should be converted to type Integer
43
!                              after the function call to avoid
44
!                              type conflicts.
45
! ---------------------------------------------------------------------
46
      Real(l_), Parameter :: 
47
     &                       releps = 1.0_l_, rmin = 1.0_l_, 
48
     &                       rmax   = 1.0_l_, t    = 1.0_l_,
49
     &                       b      = 1.0_l_
50

    
51
!----------------------------------------------------------------------
52
! --- Return value according to value of 'i'.
53

    
54
      Select Case( i )
55
! ---------------------------------------------------------------------
56
! --- Relative machine precision:
57

    
58
      Case( 1 )
59
         mpar = Epsilon( releps )
60
! ---------------------------------------------------------------------
61
! --- Smallest representable f.p. number:
62

    
63
      Case( 2 )
64
         mpar = Tiny( rmin )
65
! ---------------------------------------------------------------------
66
! --- Largest representable f.p. number:
67

    
68
      Case( 3 )
69
         mpar = Huge( rmax )
70
! ---------------------------------------------------------------------
71
! --- Number of base B digits.
72

    
73
      Case( 4 ) 
74
         mpar = Digits( t )
75
! ---------------------------------------------------------------------
76
! --- Base B of floating-point representation.
77

    
78
      Case( 5 )
79
         mpar = Radix( b )
80
! ---------------------------------------------------------------------
81
! --- Number of bits in floating-point representation used: P.
82

    
83
      Case( 6 )
84
         p = Log( Dble( Maxexponent(b) ) )
85
         mpar =  p/Log( 2.0_l_ ) + Digits( b ) + 1.0_l_
86
! ---------------------------------------------------------------------
87
! --- i out of range:
88

    
89
      Case Default
90
         Print *, 'Parameter i out of range in function dmacdp:', i
91
         Stop    
92
      End Select
93
! ---------------------------------------------------------------------
94
      Return
95
      End