IEEE_ARITHMETIC
has new functions IEEE_NEXT_DOWN
and IEEE_NEXT_UP
.
These are elemental with a single argument, which must be a REAL
of an IEEE kind (that is,
IEEE_SUPPORT_DATATYPE
must return .TRUE.
for that kind of REAL
).
They return the next IEEE value, that does not compare equal to the argument, in the downwards and
upwards directions respectively, except that the next down from −∞ is −∞ itself,
and the next up from +∞ is +∞ itself.
These functions are superior to the old IEEE_NEXT_AFTER
function in that they do not signal
any exception unless the argument is a signalling NaN (in which case IEEE_INVALID
is signalled).
For example, IEEE_NEXT_UP(-0.0)
and IEEE_NEXT_UP(+0.0)
both return the smallest positive
subnormal value (provided subnormal values are supported), without signalling IEEE_UNDERFLOW
(which IEEE_NEXT_AFTER
does).
Similarly, IEEE_NEXT_UP(HUGE(0.0))
returns +∞ without signalling overflow.
IEEE_ARITHMETIC
has new named constants IEEE_NEGATIVE_SUBNORMAL
,
IEEE_POSITIVE_SUBNORMAL
, and the new function IEEE_SUPPORT_SUBNORMAL
.
These are from Fortran 2018, and reflect the change of terminology in the IEEE arithmetic
standard in 2008.
They are equivalent to the old functions IEEE_NEGATIVE_DENORMAL
, IEEE_POSITIVE_DENORMAL
and IEEE_SUPPORT_DENORMAL
.
FLAG_VALUE
argument to IEEE_GET_FLAG
and IEEE_SET_FLAG
,
the HALTING
argument to IEEE_GET_HALTING_MODE
and IEEE_SET_HALTING_MODE
, and the
GRADUAL
argument to IEEE_GET_UNDERFLOW_MODE
and IEEE_SET_UNDERFLOW_MODE
, be
default LOGICAL
has been dropped; any kind of LOGICAL
is now permitted.
For example,
USE F90_KIND USE IEEE_ARITHMETIC LOGICAL(byte) flags(SIZE(IEEE_ALL)) CALL IEEE_GET_FLAG(IEEE_ALL,flags)will retrieve the current IEEE flags into an array of one-byte
LOGICAL
s.