Calculates machine (computing) parameters author: P J Knight, CCFE, Culham Science Centre i : input integer : Switch for return value: i=1 : B(1 - P), the machine precision i=2 : B(EMIN - 1), the smallest magnitude i=3 : BEMAX*(1 - B(-P)), the largest magnitude where the machine being used has P base B digits, and its smallest and largest exponents are EMIN and EMAX, respectively. This routine evaluates the numerical machine parameters of the computer being used to run the program, as defined above.
Note that the values of these parameters can be found for a given machine if the Mark 12 or later NAg library is installed on it.
SPMPAR(1)
is equivalent to X02AJF()
;
SPMPAR(2)
is equivalent to X02AKF()
;
SPMPAR(3)
is equivalent to X02ALF()
.
Metcalf and Reid, Fortran 90/95 Explained, 2nd Edition (section 8.7.2)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | i |
function spmpar(i)
!! Calculates machine (computing) parameters
!! author: P J Knight, CCFE, Culham Science Centre
!! i : input integer : Switch for return value:
!! i=1 : B**(1 - P), the machine precision
!! i=2 : B**(EMIN - 1), the smallest magnitude
!! i=3 : B**EMAX*(1 - B**(-P)), the largest magnitude
!! where the machine being used has P base B digits, and its smallest
!! and largest exponents are EMIN and EMAX, respectively.
!! This routine evaluates the numerical machine parameters of the
!! computer being used to run the program, as defined above.
!! <P>Note that the values of these parameters can be found for a given
!! machine if the Mark 12 or later NAg library is installed on it.
!! <P><CODE>SPMPAR(1)</CODE> is equivalent to <CODE>X02AJF()</CODE>;
!! <BR><CODE>SPMPAR(2)</CODE> is equivalent to <CODE>X02AKF()</CODE>;
!! <BR><CODE>SPMPAR(3)</CODE> is equivalent to <CODE>X02ALF()</CODE>.
!! Metcalf and Reid, Fortran 90/95 Explained, 2nd Edition (section 8.7.2)
!
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
implicit none
real(dp) :: spmpar
! Arguments
integer, intent(in) :: i
! Local variables
real(dp), dimension(3) :: rmach
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Previously-used hardwired values shown in comments
!rmach(1) = 1.110223024625157D-016
rmach(1) = epsilon(0.0D0)
!rmach(2) = 2.3D-308
rmach(2) = tiny(0.0D0)
!rmach(3) = 1.797693134862316D+308
rmach(3) = huge(0.0D0)
spmpar = rmach(i)
end function spmpar