Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"So why don't you make like a tree, and get outta here." -- Biff in "Back to the Future"


devel / comp.lang.fortran / Fwd: Clarification requested on INTEGER range and the OUT_OF_RANGE() function

SubjectAuthor
* Fwd: Clarification requested on INTEGER range and the OUT_OF_RANGE()Ron Shepard
`- Re: Clarification requested on INTEGER range and the OUT_OF_RANGE() functionJohn

1
Fwd: Clarification requested on INTEGER range and the OUT_OF_RANGE() function

<xK1TK.36431$OR4c.35259@fx46.iad>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2863&group=comp.lang.fortran#2863

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx46.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:102.0)
Gecko/20100101 Thunderbird/102.2.2
Subject: Fwd: Clarification requested on INTEGER range and the OUT_OF_RANGE()
function
Content-Language: en-US
References: <md5:+fqNHAXs+SOBBmTUzy0gfw==>
Newsgroups: comp.lang.fortran
From: nospam@nowhere.org (Ron Shepard)
In-Reply-To: <md5:+fqNHAXs+SOBBmTUzy0gfw==>
X-Forwarded-Message-Id: <md5:+fqNHAXs+SOBBmTUzy0gfw==>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 28
Message-ID: <xK1TK.36431$OR4c.35259@fx46.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Sat, 10 Sep 2022 10:07:09 -0500
X-Received-Bytes: 1933
 by: Ron Shepard - Sat, 10 Sep 2022 15:07 UTC

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

Re: Clarification requested on INTEGER range and the OUT_OF_RANGE() function

<913fc782-7a73-4ae9-ac51-e121dfd07777n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2865&group=comp.lang.fortran#2865

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ae9:e404:0:b0:6bb:d8c0:381c with SMTP id q4-20020ae9e404000000b006bbd8c0381cmr15094036qkc.459.1662858298442;
Sat, 10 Sep 2022 18:04:58 -0700 (PDT)
X-Received: by 2002:a05:622a:490:b0:344:9d1c:d4b6 with SMTP id
p16-20020a05622a049000b003449d1cd4b6mr17743068qtx.196.1662858298315; Sat, 10
Sep 2022 18:04:58 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Sat, 10 Sep 2022 18:04:58 -0700 (PDT)
In-Reply-To: <xK1TK.36431$OR4c.35259@fx46.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:546:300:4c20:6c5a:2542:dac8:ac46;
posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 2601:546:300:4c20:6c5a:2542:dac8:ac46
References: <md5:+fqNHAXs+SOBBmTUzy0gfw==> <xK1TK.36431$OR4c.35259@fx46.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <913fc782-7a73-4ae9-ac51-e121dfd07777n@googlegroups.com>
Subject: Re: Clarification requested on INTEGER range and the OUT_OF_RANGE() function
From: urbanjost@comcast.net (John)
Injection-Date: Sun, 11 Sep 2022 01:04:58 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1847
 by: John - Sun, 11 Sep 2022 01:04 UTC

In the case of the example if the first argument was a one byte integer of value -128 ABS would be problematic because it would be trying to return 128, which is out of bounds, but for most other types or if you have a larger type to promote it to with INT it would work. For the time being we made a function called OUT_OF_MODEL_RANGE that does what he wants. After going through the standard again with the references sited here in hand it does look like OUT_OF_RANGE is determining if a value is represent-able, not that it fits the model, as you note -- so no bug reports.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor