Dear All,
I'd like to initialize some constants used in a numerical algorithm
using the HUGE and EPSILON intrinsics. However some of the constant
data that depends on the values of those functions has to be
calculated using other intrinsics, e.g. SQRT.
I'd like to write:
----
MODULE NumericConstants
USE Kinds
IMPLICIT NONE
PUBLIC
REAL(dbl) :: &
ZeroTolDbl = SQRT( EPSILON( 1.0_dbl ) ), &
InfDbl = SQRT( HUGE( 1.0_dbl ) )
END MODULE NumericConstants
----
It is forbidden by the standard (says my compiler) to initialize
it like that. Instead I have to write a lot more code and check
for the proper initializations myself. Can enyone tell me WHY????
MODULE NumericConstants
USE Kinds
IMPLICIT NONE
PUBLIC
REAL(dbl) :: ZeroTolDbl, InfDbl
LOGICAL :: InitializedNumericConstants = .FALSE.
CONTAINS
SUBROUTINE InitializeNumericConstants
ZeroTolDbl = SQRT( EPSILON( 1.0_dbl ) )
InfDbl = SQRT( HUGE( 1.0_dbl ) )
InitializedNumericConstants = .TRUE.
END SUBROUTINE InitializeNumericConstants
END MODULE NumericConstants
Thanks for your (anticipated) help,
Artur Swietanowski
----------------------------------------------------------------------
Artur Swietanowski mailto:[log in to unmask]
Institut fuer Statistik, Operations Research und Computerverfahren,
Universitaet Wien, Universitaetsstr. 5, A-1010 Wien, Austria
tel. +43 (1) 407 63 55 - 120 fax +43 (1) 406 41 59
----------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|