Visible to Intel only — GUID: GUID-75DAF967-3ABB-4926-92DF-659407D31416
Visible to Intel only — GUID: GUID-75DAF967-3ABB-4926-92DF-659407D31416
OUT_OF_RANGE
Elemental Intrinsic Function (Generic): Indicates if a value can be safely converted to a specified type.
Syntax
result = OUT_OF_RANGE (value, mold [, round])
value |
(Input) Must be of type integer or real. |
mold |
(Input) Must be a scalar of type real or integer. It need not be defined if it is a variable. |
round |
(Input; optional) Must be a scalar logical. round can only be present if value is type real and mold is type integer. |
Results
The result type is default logical.
If round is not present or has the value .false., and mold is an integer type, the result is .true. if value is a NaN or an IEEE infinity, or if the integer with the largest magnitude between zero and value (inclusively) is not representable by an object with the type and kind of mold.
If round has the value .true. and mold is an integer type, the result is .true. if value is a NaN or an IEEE infinity, or if the integer value nearest value, or the integer of greater magnitude if the two integers are equally near value, is not representable by an object with the type and kind of mold.
Otherwise, the result is .true. if value is a NaN or IEEE infinity that is not supported by an object of type and kind of mold, or X is a finite number and the result of rounding value to the extended model for the kind of mold has a magnitude larger than that of the largest finite number with the same size as value that can be represented by objects with the type and kind of mold.
Example
If J8 is a variable with type INTEGER (KIND=1), OUT_OF_RANGE (-128.5, J8) will have the result .false. and OUT_OF_RANGE (-128.5, J8, .TRUE.) will have the value .true..