https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115788

            Bug ID: 115788
           Summary: [F2018] Implement OUT_OF_RANGE
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anlauf at gcc dot gnu.org
  Target Milestone: ---

F2018 has:

16.9.146  OUT_OF_RANGE (X, MOLD [, ROUND])

Description. Whether a value cannot be converted safely.

Class. Elemental function.

Arguments.

X  shall be of type integer or real.

MOLD  shall be an integer or real scalar. If it is a variable, it need not be
defined.

ROUND (optional) shall be a logical scalar. ROUND shall be present only if X
is of type real and MOLD is of type integer.

Result Characteristics. Default logical.

Result Value.

Case(i):

If MOLD is of type integer, and ROUND is absent or present with the value
false, the result is true if and only if the value of X is an IEEE infinity
or NaN, or if the integer with largest magnitude that lies between zero and
X inclusive is not representable by objects with the type and kind of MOLD.

Case(ii):

If MOLD is of type integer, and ROUND is present with the value true, the
result is true if and only if the value of X is an IEEE infinity or NaN,
or if the integer nearest X, or the integer of greater magnitude if two
integers are equally near to X, is not representable by objects with the
type and kind of MOLD.

Case(iii):

Otherwise, the result is true if and only if the value of X is an IEEE
infinity or NaN that is not supported by objects of the type and kind of
MOLD, or if X is a finite number and the result of rounding the value of X
(according to the IEEE rounding mode if appropriate) to the extended model
for the kind of MOLD has magnitude larger than that of the largest finite
number with the same sign as X that is representable by objects with the
type and kind of MOLD.

Examples. If INT8 is the kind value for an 8-bit binary integer type,
OUT_OF_RANGE (−128.5, 0_INT8) will have the value false and
OUT_OF_RANGE (−128.5, 0_INT8, .TRUE.) will have the value true.

Reply via email to