IEEE_EXPONENT(3I) Last changed: 1-6-98
NAME
IEEE_EXPONENT - Returns the unbiased exponent of x
SYNOPSIS
IEEE_EXPONENT ([X=]x[, [Y=]y])
IMPLEMENTATION
UNICOS/mk and IRIX systems
CRAY T90 systems that support IEEE floating-point arithmetic
STANDARDS
CF90 and MIPSpro 7 Fortran 90 compiler extension to Fortran 90
IEEE Standard for Binary Floating-point Arithmetic
DESCRIPTION
The IEEE_EXPONENT intrinsic function returns the unbiased exponent of
x. This function corresponds to the logb function described in the
IEEE standard appendix of recommended functions.
The IEEE_EXPONENT function accepts the following arguments:
x Must be of type real. Can be a scalar or array value.
y Can be of type integer or real. Must be a scalar value.
IEEE_EXPONENT is an elemental function. The name of this intrinsic
cannot be passed as an argument.
RESULT TYPE AND TYPE PARAMETER
If x is a scalar, the result is a scalar. If x is an array, the
result is an array of the same shape as x.
If y is absent, the result is of type default integer.
If y is present and is of type integer, the result is of type integer
and has the same kind type parameter value as y.
If y is present and is of type real, the result is of type real and
has the same kind type parameter value as y.
NOTES
The IEEE intrinsic procedures use the named constants contained in a
system module, so you must include one of the following statements in
your program:
* On UNICOS and UNICOS/mk systems: USE CRI_IEEE_DEFINITIONS
* On UNICOS, UNICOS/mk, and IRIX systems: USE FTN_IEEE_DEFINITIONS
The CRI_IEEE_DEFINITIONS module is obsolescent. It will be removed
for the CF90 4.0 release.
RETURN VALUES
The result is the value of the unbiased exponent of x.
If y is absent and x is +inf, -inf, or NaN, the result is HUGE(0). If
x is 0.0, the result is -HUGE(0).
If y is present and of type integer and x is +inf, -inf, or NaN, the
result is HUGE(y). If x is 0.0, the result is -HUGE(y).
If y is present and of type real, the value is an integral value in
floating-point format. If x is a NaN, the result is a NaN. If x is
+inf or -inf, the result is +inf. If x is 0.0, the result is -inf and
the division by zero exception is raised.
When x is positive and finite, the expression IEEE_BINARY_SCALE(X,
-IEEE_EXPONENT(X)) lies strictly between 0 and 2; it is less than 1
only when x is denormalized.
EXAMPLES
Example 1.
REAL x
... ! Compute X.
PRINT *, "Unbiased exponent of X:", IEEE_EXPONENT(x)
The PRINT statement prints the unbiased exponent of x as a default
integer value as long as x is not one of the exceptional values noted
in the RETURN VALUES section.
Example 2. Program ieexp.f90 uses several intrinsic procedures:
REAL(8) X
PRINT *," TEST EXPONENT and IEEE_EXPONENT of HUGE"
X = HUGE(1.0_8)
! HUGE scaled to 0.xxx
PRINT *," F90 EXPONENT of x=",EXPONENT(x)
! HUGE scaled to x.xx
PRINT *," Unbiased IEEE_EXPONENT of x=",IEEE_EXPONENT(x)
PRINT *," TEST EXPONENT and IEEE_EXPONENT of TINY"
X = TINY(1.0_8)
! TINY scaled to 0.xxx
PRINT *," F90 EXPONENT of x=",EXPONENT(x)
! TINY scaled to x.xx
PRINT *," Unbiased IEEE_EXPONENT of x=",IEEE_EXPONENT(x)
END
The output from this program is as follows:
TEST EXPONENT and IEEE_EXPONENT of HUGE
F90 EXPONENT of x= 1024
Unbiased IEEE_EXPONENT of x= 1023
TEST EXPONENT and IEEE_EXPONENT of TINY
F90 EXPONENT of x= -1021
Unbiased IEEE_EXPONENT of x= -1022
SEE ALSO
Intrinsic Procedures Reference Manual, publication SR-2138, for the
printed version of this man page.