ieee_next_after

Date:

10-12-2011

NAME

IEEE_NEXT_AFTER - Returns the next representable neighbor of x in the direction toward y

SYNOPSIS

IEEE_NEXT_AFTER ([X=]x [,Y=]y)

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

Fortran

IEEE Standard for Binary Floating-point Arithmetic

DESCRIPTION

The IEEE_NEXT_AFTER intrinsic function returns the next representable neighbor of x in the direction toward y.

IEEE_NEXT_AFTER and the Fortran intrinsic function NEAREST have a number of differences, including the Fortran 95 restriction that argument s to NEAREST must not be zero.

IEEE_NEXT_AFTER accepts the following arguments:

x

Must be of type real.

y

Must be of type real.

IEEE_NEXT_AFTER 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_NEXT_AFTER.

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

RETURN VALUES

The result type and type parameter is the same type and type parameter as x.

The following special cases can affect the result value:

  • If x = y, the result is x without any exception being signaled.

  • If x/=y, the result is the next representable neighbor of x in the direction of y.

    • The neighbors of positive or negative zero are nonzero.

    • If either x or y is a quiet NaN, the result is one or the other of the input NaNs.

    • Overflow is signaled when x is finite but IEEE_NEXT_AFTER(x,y) is infinite. Underflow is signaled when IEEE_NEXT_AFTER(x,y) lies strictly between the following values:

    -2**Emin and +2**Emin
    
    • In both of the previous cases, the inexact exception is signaled.

EXAMPLES

USE, INTRINSIC :: IEEE_ARITHMETIC
REAL   x, y
y = IEEE_NEXT_AFTER(x, 1.0)

SEE ALSO

nearest(3i)