Sun Studio 12: Fortran Library Reference

2.2.1 IEEE Arithmetic and Exceptions Modules

The Fortran 2003 standard intrinsic modules IEEE_EXCEPTIONS, IEEE_ARITHMETIC, and IEEE_FEATURES to support new features in the proposed language standard to support IEEE arithmetic and IEEE exception handling.

The draft standard defines a set of inquiry functions, elemental functions, kind functions, elemental subroutines, and nonelemental subroutines. These are listed in the tables that follow.

To access these functions and subroutines, the calling routine must include

USE, INTRINSIC :: IEEE_ARITHMETIC, IEEE_EXCEPTIONS

See the Fortran standard (http://www.j3-fortran.org) for details.

2.2.1.1 Inquiry Functions

The module IEEE_EXCEPTIONS contains the following inquiry functions.

Function  

Descripton  

IEEE_SUPPORT_FLAG(FLAG[,X])

Inquire whether the processor supports an exception. 

IEEE_SUPPORT_HALTING(FLAG)

Inquire whether the processor supports control of halting after an exception. 

The module IEEE_ARITHMETIC contains the following inquiry functions.

Function  

Description  

IEEE_SUPPORT_DATATYPE([X])

Inquire whether the processor supports IEEE arithmetic. 

IEEE_SUPPORT_DENORMAL([X])

Inquire whether the processor supports denormalized numbers. 

IEEE_SUPPORT_DIVIDE([X])

Inquire whether the processor supports divide with the accuracy specified by the IEEE standard. 

IEEE_SUPPORT_INF([X])

Inquire whether the processor supports the IEEE infinity. 

IEEE_SUPPORT_IO([X])

Inquire whether the processor supports IEEE base conversion rounding during formatted input/output. 

IEEE_SUPPORT_NAN([X])

Inquire whether the processor supports the IEEE Not-a-Number. 

IEEE_SUPPORT_ROUNDING(VAL[,X])

Inquire whether the processor supports a particular rounding mode. 

IEEE_SUPPORT_SQRT([X])

Inquire whether the processor supports the IEEE square root. 

IEEE_SUPPORT_STANDARD([X])

Inquire whether the processor supports all IEEE facilities. 

2.2.1.2 Elemental Functions

The module IEEE_ARITHMETIC contains the following elemental functions for real X and Y for which IEEE_SUPPORT_DATATYPE(X) and IEEE_SUPPORT_DATATYPE(Y) are true.

Function  

Description  

IEEE_CLASS(X)

IEEE class. 

IEEE_COPY_SIGN(X,Y)

IEEE copysign function. 

IEEE_IS_FINITE(X)

Determine if value is finite. 

IEEE_IS_NAN(X)

Determine if value is IEEE Not-a-Number 

IEEE_IS_NORMAL(X)

Determine if a value is normal. 

IEEE_IS_NEGATIVE(X)

Determine if value is negative. 

IEEE_LOGB(X)

Unbiased exponent in the IEEE floating point format. 

IEEE_NEXT_AFTER(X,Y)

Returns the next representable neighbor of X in the direction toward Y.

IEEE_REM(X,Y)

The IEEE REM remainder function, X - Y*N where N is the integer nearest to the exact value of X/Y.

IEEE_RINT(X)

Round to an integer value according to the current rounding mode. 

IEEE_SCALB(X,I)

Returns X*2**I

IEEE_UNORDERED(X,Y)

IEEE unordered function. True if X or Y is a NaN and false otherwise.

IEEE_VALUE(X,CLASS)

Generate an IEEE value. 

2.2.1.3 Kind Function

The module IEEE_ARITHMETIC contains the following transformational function:

Function  

Description  

IEEE_SELECTED_REAL_KIND([P,][R])

Kind type parameter value fo an IEEE real with given precision and range. 

2.2.1.4 Elemental Subroutines

The module IEEE_EXCEPTIONS contains the following elemental subroutines.

Subroutine  

Description  

IEEE_GET_FLAG(FLAG,FLAG_VALUE)

Get an exception flag. 

IEEE_GET_HALTING_MODE(FLAG,HALTING)

GEt halting mode for an exception. 

2.2.1.5 Nonelemental Subroutines

The module IEEE_EXCEPTIONS contains the following nonelemental subroutines.

Subroutine  

Description  

IEEE_GET_STATUS(STATUS_VALUE)

Get the current state of the floating point environment. 

IEEE_SET_FLAG(FLAG,FLAG_VALUE)

Set an exception flag. 

IEEE_SET_HALTING_MODE(FLAG,HALTING)

Controls continuation or halting on exceptions. 

IEEE_SET_STATUS(STATUS_VALUE)

Restore the state of the floating point environment. 

The module IEEE_ARITHMETIC contains the following nonelemental subroutines.

Subroutine  

Description  

IEEE_GET_ROUNDING_MODE(ROUND_VAL)

Get the current IEEE rounding mode. 

IEEE_SET_ROUNDING_MODE(ROUND_VAL)

Set the current IEEE rounding mode.