Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

IEEE_NEXT_AFTER

Elemental Module Intrinsic Function (Generic): Returns the next representable value after X toward Y. This is equivalent to the IEEE nextafter function.

Module

USE, INTRINSIC :: IEEE_ARITHMETIC

result = IEEE_NEXT_AFTER (x,y)

x

(Input) Must be of type REAL.

y

(Input) Must be of type REAL.

Results

The result type and kind are the same as x. If x is equal to y, the result is x; no exception is signaled. If x is not equal to y, the result has the value of the next representable neighbor of x toward y. The neighbors of zero (of either sign) are both nonzero.

The following exceptions are signaled under certain cases:

Exception Signaled

IEEE_OVERFLOW

When X is finite but IEEE_NEXT_AFTER(X,Y) is infinite

IEEE_UNDERFLOW

When IEEE_NEXT_AFTER(X,Y) is subnormal

IEEE_INEXACT

In both the above cases

Example

The value of IEEE_NEXT_AFTER (2.0,3.0) is 2.0 + EPSILON (X).