intro_ieee
- Date:
10-12-2011
NAME
INTRO_IEEE - Introduction to Fortran standard modules and procedures for IEEE
DESCRIPTION
Three intrinsic Fortran modules provide support for IEEE exceptions and arithmetic: IEEE_EXCEPTIONS, IEEE_ARITHMETIC, and IEEE_FEATURES. These modules provide IEEE procedures and named constants that can be used to check for IEEE exceptions and arithmetic support.
IEEE_EXCEPTIONS Module
The IEEE_EXCEPTIONS module defines the following named constants for the exceptions:
IEEE_DIVIDE_BY_ZERO
IEEE_INEXACT
IEEE_INVALID
IEEE_OVERFLOW
IEEE_UNDERFLOW
The IEEE_EXCEPTIONS module defines an IEEE_FLAG_TYPE and an IEEE_STATUS_TYPE.
The IEEE_FLAG_TYPE is provided for identifying an exception flag; its value is one of the named constants for the IEEE exceptions. The array named constant IEEE_USUAL contains elements IEEE_OVERFLOW, IEEE_DIVIDE_BY_ZERO, and IEEE_INVALID.
The array named contant IEEE_ALL contains elements IEEE_USUAL, IEEE_UNDERFLOW, and IEEE_INEXACT.
The IEEE_STATUS_TYPE is provided for saving the current floating-point status.
IEEE_ARITHMETIC Module
The IEEE_ARITHMETIC module defines IEEE_CLASS_TYPE to identify a class of floating point values. The named constants for IEEE_CLASS_TYPE are:
IEEE_SIGNALING_NAN
IEEE_QUIET_NAN
IEEE_NEGATIVE_DENORMAL
IEEE_NEGATIVE_INF
IEEE_NEGATIVE_NORMAL
IEEE_NEGATIVE_ZERO
IEEE_POSITIVE_DENORMAL
IEEE_POSITIVE_INF
IEEE_POSITIVE_NORMAL
IEEE_POSITIVE_ZERO
IEEE_OTHER_VALUE
The IEEE_ARITHMETIC module defines IEEE_ROUND_TYPE to identify a particular IEEE rounding mode. The named constants for IEEE_ROUNDS_TYPE are:
IEEE_DOWN
IEEE_NEAREST
IEEE_OTHER
IEEE_TO_ZERO
IEEE_UP
The IEEE_ARITHMETIC module defines the == operator to determine if two values of type IEEE_ROUND_TYPE or IEEE_CLASS_TYPE are the same. The operation returns true if they are the same and false otherwise.
The IEEE_ARITHMETIC module defines the /= operator to determine if two values of type IEEE_ROUND_TYPE or IEEE_CLASS_TYPE differ. The operation returns true if they differ and false otherwise.
IEEE_FEATURES Module
The IEEE_FEATURES module defines IEEE_FEATURES_TYPE to identify the status of a particular IEEE feature. The named constants for this type are:
IEEE_DATATYPE
IEEE_DENORMAL
IEEE_DIVIDE
IEEE_HALTING
IEEE_INEXACT_FLAG
IEEE_INF
IEEE_INVALID_FLAG
IEEE_NAN
IEEE_ROUNDING
IEEE_SQRT
IEEE_UNDERFLOW_FLAG
The IEEE procedures consist of functions and subroutines.
Inquiry Functions
The IEEE_EXCEPTIONS module contains the following inquiry functions:
- IEEE_SUPPORT_FLAG(FLAG[,X])
Are IEEE exceptions supported?
- IEEE_SUPPORT_HALTING(FLAG)
Is IEEE halting control supported?
The IEEE_ARITHMETIC module contains the following inquiry functions:
- IEEE_SUPPORT_DATATYPE([X])
Is IEEE arithmetic supported?
- IEEE_SUPPORT_DENORMAL([X])
Are IEEE denormalized numbers supported?
- IEEE_SUPPORT_DIVIDE([X])
Is IEEE divide supported?
- IEEE_SUPPORT_INF([X])
Is IEEE infinity supported?
- IEEE_SUPPORT_IO([X])
Supports IEEE base conversion rounding during formatted input/output?
- IEEE_SUPPORT_NAN([X])
Are IEEE NaNs supported?
- IEEE_SUPPORT_ROUNDING(ROUND_VALUE[,X])
Is IEEE rounding supported?
- IEEE_SUPPORT_SQRT([X])
Is IEEE SQRT supported?
- IEEE_SUPPORT_STANDARD([X])
Are all IEEE facilities supported?
- IEEE_SUPPORT_UNDERFLOW_CONTROL([X])
Is IEEE underflow control supported?
Elemental Functions
The IEEE_ARITHMETIC module contains the elemental functions for reals X and Y when the IEEE_SUPPORT_DATATYPE(X) and IEEE_SUPPORT_DATATYPE(Y) are true:
- IEEE_CLASS(X)
Returns IEEE class.
- IEEE_COPY_SIGN(X,Y)
IEEE copy sign function. Returns the value of X with the sign of Y.
- IEEE_IS_FINITE(X)
Is the value X finite?
- IEEE_IS_NAN(X)
Is the value Xa NaN?
- IEEE_IS_NORMAL(X)
Is the value X normal (that is, neither infinity, NaN, nor denormalized)?
- IEEE_IS_NEGATIVE(X)
Is the value X negative?
- IEEE_LOGB(X)
Returns the unbiased exponent of X.
- IEEE_NEXT_AFTER(X,Y)
Returns the next representable neighbor of X.
- IEEE_REM(X,Y)
Returns X-Y*N, where N is the integer nearest to the exact value of X/Y.
- IEEE_RINT(X)
Rounds to integer value according to the current rounding mode.
- IEEE_SCALB(X,I)
Returns X* 2**I
- IEEE_UNORDERED(X,Y)
IEEE unordered function. Returns true if X or Y is NaN and false otherwise.
- IEEE_VALUE(X,CLASS)
Generates an IEEE value.
KIND Function
The IEEE_ARITHMETIC module contains the transformational kind function:
- IEEE_SELECTED_REAL_KIND([P,R])
Returns kind type parameter value for an IEEE real with precision P and range R.
Elemental Subroutines
The IEEE_EXCEPTIONS module contains the elemental subroutines:
- IEEE_GET_FLAG(FLAG,FLAG_VALUE)
Gets an exception flag.
- IEEE_GET_HALTING_MODE(FLAG,HALTING)
Gets halting mode for an exception.
Nonelemental Subroutines
The IEEE_EXCEPTIONS module contains the nonelemental subroutines:
- IEEE_GET_STATUS(STATUS_VALUE)
Returns current floating-point status.
- IEEE_SET_FLAG(FLAG,FLAG_VALUE)
Sets an exception flag.
- IEEE_SET_HALTING_MODE(FLAG,HALTING)
Controls continuation or halting on exceptions.
- IEEE_SET_STATUS(STATUS_VALUE)
Restores current state of floating_point environment.
Only IEEE_SET_FLAG and IEEE_SET_HALTING_MODE are pure subroutines in module IEEE_EXCEPTIONS.
The IEEE_ARITHMETIC module contains the nonelemental subroutines:
- IEEE_GET_ROUNDING_MODE(ROUND_VALUE)
Gets current IEEE rounding mode.
- IEEE_GET_UNDERFLOW_MODE(GRADUAL)
Gets current underflow mode.
- IEEE_SET_ROUNDING_MODE(ROUND_VALUE)
Sets current IEEE rounding mode.
- IEEE_SET_UNDERFLOW_MODE(GRADUAL)
Sets current underflow mode.
The IEEE_ARITHMETIC module does not have any pure nonelemental subroutines.
SEE ALSO
ieee_class(3i), ieee_copy_sign(3i), ieee_is_finite(3i), ieee_is_nan(3i), ieee_is_normal(3i), ieee_is_negative(3i), ieee_logb(3i), ieee_next_after(3i), ieee_rem(3i), ieee_rint(3i), ieee_scalb(3i), ieee_unordered(3i), ieee_value(3i), ieee_selected_real_kind(3i), ieee_get_flag(3i), ieee_get_halting_mode(3i), ieee_get_rounding_mode(3i), ieee_get_status(3i), ieee_get_underflow_mode(3i), ieee_set_flag(3i), ieee_set_halting_mode(3i), ieee_set_rounding_mode(3i), ieee_set_status(3i), ieee_set_underflow_mode(3i), ieee_support_flag(3i), ieee_support_halting(3i), ieee_support_datatype(3i), ieee_support_datatype(3i), ieee_support_denormal(3i), ieee_support_divide, ieee_support_inf(3i), ieee_support_io(3i), ieee_support_nan(3i), ieee_support_rounding_value(3i), ieee_support_sqrt(3i), ieee_support_standard(3i), ieee_support_underflow_control(3i)