• Fwd: Clarification requested on INTEGER range and the OUT_OF_RANGE() fu

    From Ron Shepard@21:1/5 to John on Sat Sep 10 10:07:09 2022
    On 9/9/22 10:43 AM, John wrote:

    On most machines -1-huge(0) is representable, but should OUT_OF_RANGE(-1-huge(0)) return .FALSE.?

    Since how a negative integer is represented at the bit level is processor dependent, should the range (for example) of a 1-byte integer be treated
    as -127 to 127 or -128 to 127?
    [...]

    You may already know this, but this is the example in the f2018 standard:

    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.

    The first case is rounded toward zero, -128, while the second is rounded
    the other way to -129.

    The description of the function only refers to whether the value is representable, so I think -128 is intended to satisfy that. This is not
    the same as the fortran integer model, which does not include the value
    -128. The integer model is defined in Section 16.4.

    $.02 -Ron Shepard

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)