ieee_class

Date:

10-12-2011

NAME

IEEE_CLASS - Returns the class to which x belongs

SYNOPSIS

IEEE_CLASS ([X=]x)

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

Fortran

IEEE Standard for Binary Floating-point Arithmetic

DESCRIPTION

A floating-point number can be classified several ways, such as a quiet NaN, a signaling NaN, -0, +inf, and so on. The IEEE_CLASS intrinsic function returns a value that indicates the class to which x belongs.

This function accepts the following argument:

x

Must be of type real.

IEEE_CLASS is an elemental function. The name of this intrinsic cannot be passed as an argument.

NOTES

The IEEE intrinsic procedures use the named constants contained in a system module, so you must include the following statement in your program:

USE, INTRINSIC :: IEEE_ARITHMETIC

Use the IEEE_SUPPORT_DATATYPE(x) to determine if the data type and type parameters are supported before referencing IEEE_CLASS.

RETURN VALUES

The result type TYPE(IEEE_CLASS_TYPE).

The value returned has a value represented by one of the following named constants:

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

EXAMPLES

USE, INTRINSIC :: IEEE_ARITHMETIC
REAL   x
TYPE(IEEE_CLASS_TYPE) :: class_value

   ! Compute x
class_value = IEEE_CLASS(x)

IF (class_value == IEEE_SIGNALING_NAN) THEN
   ! Do something.
ELSE IF (class_value == IEEE_POSITIVE_ZERO) THEN
   ! Do something else.
ELSE
   ! Other cases.
ENDIF