Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Ignorance is bliss. -- Thomas Gray Fortune updates the great quotes, #42: BLISS is ignorance.


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

SubjectAuthor
* Clarification requested on INTEGER range and the OUT_OF_RANGE() functionJohn
+- Re: Clarification requested on INTEGER range and the OUT_OF_RANGE() functionRobin Vowels
+- Re: Clarification requested on INTEGER range and the OUT_OF_RANGE() functiongah4
+- Re: Clarification requested on INTEGER range and the OUT_OF_RANGE() functiongah4
`* Re: Clarification requested on INTEGER range and the OUT_OF_RANGE()Thomas Koenig
 `* Re: Clarification requested on INTEGER range and the OUT_OF_RANGE() functiongah4
  +- Re: Clarification requested on INTEGER range and the OUT_OF_RANGE() functionJohn
  `* Re: Clarification requesited on INTEGER range and the OUT_OF_RANGE() functionJohn
   `* Re: Clarification requesited on INTEGER range and the OUT_OF_RANGE()Ron Shepard
    `* Re: Clarification requesited on INTEGER range and the OUT_OF_RANGE() functiongah4
     `* Re: Clarification requesited on INTEGER range and the OUT_OF_RANGE() functionJohn
      `- Re: Clarification requesited on INTEGER range and the OUT_OF_RANGE() functiongah4

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

<1fe182ef-4b0a-49f5-a496-a9ea9aba54f1n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:622a:c7:b0:343:2e72:8416 with SMTP id p7-20020a05622a00c700b003432e728416mr13138223qtw.92.1662738223768;
Fri, 09 Sep 2022 08:43:43 -0700 (PDT)
X-Received: by 2002:ac8:5a81:0:b0:342:fad3:b79e with SMTP id
c1-20020ac85a81000000b00342fad3b79emr13195013qtc.77.1662738223632; Fri, 09
Sep 2022 08:43:43 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.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: Fri, 9 Sep 2022 08:43:43 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2601:546:300:4c20:e9e7:adfb:c266:a872;
posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 2601:546:300:4c20:e9e7:adfb:c266:a872
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1fe182ef-4b0a-49f5-a496-a9ea9aba54f1n@googlegroups.com>
Subject: Clarification requested on INTEGER range and the OUT_OF_RANGE() function
From: urbanjost@comcast.net (John)
Injection-Date: Fri, 09 Sep 2022 15:43:43 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2669
 by: John - Fri, 9 Sep 2022 15:43 UTC

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?

We were assuming a simple look through the standard would clarify it,
but we are still arguing about it.

There is a belief that there is a statement saying the allowable range
should be "symmetrical" but no one has found it.

There was a bug in a program that checked a value with OUT_OF_RANGE()
and then subsequently took the ABS() of the value (instead of
OUT_OF_RANGE(ABS(I)) it was using OUT_OF_RANGE(I) and then subsequently
using ABS(I)).

But ABS(-huge(0)-1) is an out of range value, so it caused an issue.

Discussions ensued. Can anyone point to a definitive definition of the
lowest negative value, as HUGE() always returns a positive value? Can
anyone point to a statement saying ranges are symmetrical around zero?

program demo_out_of_range
use, intrinsic :: iso_fortran_env, only : int8
implicit none
integer :: i
integer(kind=int8) :: i8

do i=-130,130
write(*,*)i, out_of_range( i,i8)
enddo

end program demo_out_of_range

One compilers' results:

-130 T
-129 T
-128 F <<< the value in debate
-127 F
-126 F
.
.
.
125 F
126 F
127 F
128 T
129 T
130 T

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

<73812f6f-18d5-45ec-9246-f318d46e6942n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a0c:ac05:0:b0:4aa:a3b3:fe3a with SMTP id l5-20020a0cac05000000b004aaa3b3fe3amr13559915qvb.35.1662751621473;
Fri, 09 Sep 2022 12:27:01 -0700 (PDT)
X-Received: by 2002:a0c:dd14:0:b0:4ac:9789:825b with SMTP id
u20-20020a0cdd14000000b004ac9789825bmr628660qvk.122.1662751621231; Fri, 09
Sep 2022 12:27:01 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.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: Fri, 9 Sep 2022 12:27:01 -0700 (PDT)
In-Reply-To: <1fe182ef-4b0a-49f5-a496-a9ea9aba54f1n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=202.67.103.232; posting-account=S_MdrwoAAAD7T2pxG2e393dk6y0tc0Le
NNTP-Posting-Host: 202.67.103.232
References: <1fe182ef-4b0a-49f5-a496-a9ea9aba54f1n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <73812f6f-18d5-45ec-9246-f318d46e6942n@googlegroups.com>
Subject: Re: Clarification requested on INTEGER range and the OUT_OF_RANGE() function
From: robin.vowels@gmail.com (Robin Vowels)
Injection-Date: Fri, 09 Sep 2022 19:27:01 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2911
 by: Robin Vowels - Fri, 9 Sep 2022 19:27 UTC

On Saturday, September 10, 2022 at 1:43:45 AM UTC+10, 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?
>
> We were assuming a simple look through the standard would clarify it,
> but we are still arguing about it.
>
> There is a belief that there is a statement saying the allowable range
> should be "symmetrical" but no one has found it.
>
> There was a bug in a program that checked a value with OUT_OF_RANGE()
> and then subsequently took the ABS() of the value (instead of
> OUT_OF_RANGE(ABS(I)) it was using OUT_OF_RANGE(I) and then subsequently
> using ABS(I)).
>
> But ABS(-huge(0)-1) is an out of range value, so it caused an issue.
>
> Discussions ensued. Can anyone point to a definitive definition of the
> lowest negative value, as HUGE() always returns a positive value? Can
> anyone point to a statement saying ranges are symmetrical around zero?
>
> program demo_out_of_range
> use, intrinsic :: iso_fortran_env, only : int8
> implicit none
> integer :: i
> integer(kind=int8) :: i8
>
> do i=-130,130
> write(*,*)i, out_of_range( i,i8)
> enddo
>
> end program demo_out_of_range
>
> One compilers' results:
>
> -130 T
> -129 T
> -128 F <<< the value in debate
..
It depends on the machine.
On twos complement hardware, this is correct.
On ones complement hardware, this would yield T.
..
> -127 F
> -126 F
> .
> .
> .
> 125 F
> 126 F
> 127 F
> 128 T
> 129 T
> 130 T

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

<974e002d-324b-4766-8305-c563e4ec9c27n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:3006:b0:496:ad87:6784 with SMTP id ke6-20020a056214300600b00496ad876784mr14941298qvb.7.1662787710766;
Fri, 09 Sep 2022 22:28:30 -0700 (PDT)
X-Received: by 2002:a05:620a:752:b0:6cd:d01f:9ae8 with SMTP id
i18-20020a05620a075200b006cdd01f9ae8mr3808491qki.647.1662787710610; Fri, 09
Sep 2022 22:28:30 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.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: Fri, 9 Sep 2022 22:28:30 -0700 (PDT)
In-Reply-To: <1fe182ef-4b0a-49f5-a496-a9ea9aba54f1n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=216.54.101.18; posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 216.54.101.18
References: <1fe182ef-4b0a-49f5-a496-a9ea9aba54f1n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <974e002d-324b-4766-8305-c563e4ec9c27n@googlegroups.com>
Subject: Re: Clarification requested on INTEGER range and the OUT_OF_RANGE() function
From: gah4@u.washington.edu (gah4)
Injection-Date: Sat, 10 Sep 2022 05:28:30 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1931
 by: gah4 - Sat, 10 Sep 2022 05:28 UTC

On Friday, September 9, 2022 at 8:43:45 AM UTC-7, 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?

The standard allows for symmetric representations.
It allows for any integer base greater than one.

Since sign-magnitude and digit-complement representations
have a symmetric range, the standard allows those.

As well as I know, it could allow for some other non-symmetric
range, if one happened to want to build such a computer.

That said, I don't know what it means for OUT_OF_RANGE.

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

<d03a48cf-b3a6-47d5-9108-0f7b89776b0en@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:1ccc:b0:496:ab0a:896a with SMTP id g12-20020a0562141ccc00b00496ab0a896amr14615996qvd.36.1662788787117;
Fri, 09 Sep 2022 22:46:27 -0700 (PDT)
X-Received: by 2002:a05:622a:14c9:b0:344:7c6d:be62 with SMTP id
u9-20020a05622a14c900b003447c6dbe62mr15235700qtx.591.1662788787007; Fri, 09
Sep 2022 22:46:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.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: Fri, 9 Sep 2022 22:46:26 -0700 (PDT)
In-Reply-To: <1fe182ef-4b0a-49f5-a496-a9ea9aba54f1n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=216.54.101.18; posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 216.54.101.18
References: <1fe182ef-4b0a-49f5-a496-a9ea9aba54f1n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d03a48cf-b3a6-47d5-9108-0f7b89776b0en@googlegroups.com>
Subject: Re: Clarification requested on INTEGER range and the OUT_OF_RANGE() function
From: gah4@u.washington.edu (gah4)
Injection-Date: Sat, 10 Sep 2022 05:46:27 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1992
 by: gah4 - Sat, 10 Sep 2022 05:46 UTC

On Friday, September 9, 2022 at 8:43:45 AM UTC-7, 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?

First, is has two arguments, so that should be an error.

But maybe you mean OUT_OF_RANGE(-1-huge(0),0)
OK, actually reading it, it says:

"largest magnitude that lies between zero and X inclusive"

That suggests that the sign is significant in the test, and so
it should be false.

Note, though, that will fail on machines with symmetric representation,
where it will underflow, and wrap on most machines. It will then
be in-range again.

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

<tfhhfe$ln7$2@newsreader4.netcologne.de>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2a0a-a540-1471-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: Clarification requested on INTEGER range and the OUT_OF_RANGE()
function
Date: Sat, 10 Sep 2022 08:22:06 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <tfhhfe$ln7$2@newsreader4.netcologne.de>
References: <1fe182ef-4b0a-49f5-a496-a9ea9aba54f1n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 10 Sep 2022 08:22:06 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2a0a-a540-1471-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2a0a:a540:1471:0:7285:c2ff:fe6c:992d";
logging-data="22247"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Sat, 10 Sep 2022 08:22 UTC

John <urbanjost@comcast.net> schrieb:

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

Examples in the standard are non-normative and can be at odds with
what the standard actually prescribes, but they usually are informative
as to what was actually intended.

The description of OUT_OF_RANGE has the example

# 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.

which indicates that at least the author of this example thought
that -128 was valid.

This appears to be at odds with Fortran's symmetric number model,
so this is a question that should probably best be addressed to
the J3 mailing list.

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

<35b4133d-79a0-492a-935d-71a7ab46adfdn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a37:9a8c:0:b0:6cd:ec57:3fe1 with SMTP id c134-20020a379a8c000000b006cdec573fe1mr3493461qke.139.1662813505616;
Sat, 10 Sep 2022 05:38:25 -0700 (PDT)
X-Received: by 2002:ae9:df01:0:b0:6bb:4e95:6a59 with SMTP id
t1-20020ae9df01000000b006bb4e956a59mr13158031qkf.339.1662813505495; Sat, 10
Sep 2022 05:38:25 -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 05:38:25 -0700 (PDT)
In-Reply-To: <tfhhfe$ln7$2@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=216.54.101.18; posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 216.54.101.18
References: <1fe182ef-4b0a-49f5-a496-a9ea9aba54f1n@googlegroups.com> <tfhhfe$ln7$2@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <35b4133d-79a0-492a-935d-71a7ab46adfdn@googlegroups.com>
Subject: Re: Clarification requested on INTEGER range and the OUT_OF_RANGE() function
From: gah4@u.washington.edu (gah4)
Injection-Date: Sat, 10 Sep 2022 12:38:25 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1817
 by: gah4 - Sat, 10 Sep 2022 12:38 UTC

On Saturday, September 10, 2022 at 1:22:10 AM UTC-7, Thomas Koenig wrote:

(snip)
> which indicates that at least the author of this example thought
> that -128 was valid.
> This appears to be at odds with Fortran's symmetric number model,
> so this is a question that should probably best be addressed to
> the J3 mailing list.

The standard guarantees that they symmetric model works.

It doesn't guarantee that other values won't.

It is especially interesting in DATA statements, which allow
for signed constants. In other statements, constants are
unsigned, with a possible unary - operator applied.

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

<c9b1919b-fc7c-473e-a367-9749738f8343n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:622a:1455:b0:343:58b7:446f with SMTP id v21-20020a05622a145500b0034358b7446fmr16732609qtx.338.1662818548849;
Sat, 10 Sep 2022 07:02:28 -0700 (PDT)
X-Received: by 2002:ac8:5bc9:0:b0:343:7c69:4a0e with SMTP id
b9-20020ac85bc9000000b003437c694a0emr16719203qtb.487.1662818548539; Sat, 10
Sep 2022 07:02:28 -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 07:02:28 -0700 (PDT)
In-Reply-To: <35b4133d-79a0-492a-935d-71a7ab46adfdn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:546:300:4c20:44a7:1541:5729:b272;
posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 2601:546:300:4c20:44a7:1541:5729:b272
References: <1fe182ef-4b0a-49f5-a496-a9ea9aba54f1n@googlegroups.com>
<tfhhfe$ln7$2@newsreader4.netcologne.de> <35b4133d-79a0-492a-935d-71a7ab46adfdn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c9b1919b-fc7c-473e-a367-9749738f8343n@googlegroups.com>
Subject: Re: Clarification requested on INTEGER range and the OUT_OF_RANGE() function
From: urbanjost@comcast.net (John)
Injection-Date: Sat, 10 Sep 2022 14:02:28 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2044
 by: John - Sat, 10 Sep 2022 14:02 UTC

On Saturday, September 10, 2022 at 8:38:27 AM UTC-4, gah4 wrote:
> On Saturday, September 10, 2022 at 1:22:10 AM UTC-7, Thomas Koenig wrote:
>
> (snip)
> > which indicates that at least the author of this example thought
> > that -128 was valid.
>
> > This appears to be at odds with Fortran's symmetric number model,
> > so this is a question that should probably best be addressed to
> > the J3 mailing list.
> The standard guarantees that they symmetric model works.
>
> It doesn't guarantee that other values won't.
>
> It is especially interesting in DATA statements, which allow
> for signed constants. In other statements, constants are
> unsigned, with a possible unary - operator applied.

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

<584acb36-fb19-4daf-9661-507237c831a4n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:622a:174b:b0:343:1fc:14d8 with SMTP id l11-20020a05622a174b00b0034301fc14d8mr16333556qtk.579.1662819228100;
Sat, 10 Sep 2022 07:13:48 -0700 (PDT)
X-Received: by 2002:ac8:5d49:0:b0:342:f7df:dbd9 with SMTP id
g9-20020ac85d49000000b00342f7dfdbd9mr16589499qtx.449.1662819227953; Sat, 10
Sep 2022 07:13:47 -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 07:13:47 -0700 (PDT)
In-Reply-To: <35b4133d-79a0-492a-935d-71a7ab46adfdn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:546:300:4c20:44a7:1541:5729:b272;
posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 2601:546:300:4c20:44a7:1541:5729:b272
References: <1fe182ef-4b0a-49f5-a496-a9ea9aba54f1n@googlegroups.com>
<tfhhfe$ln7$2@newsreader4.netcologne.de> <35b4133d-79a0-492a-935d-71a7ab46adfdn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <584acb36-fb19-4daf-9661-507237c831a4n@googlegroups.com>
Subject: Re: Clarification requesited on INTEGER range and the OUT_OF_RANGE() function
From: urbanjost@comcast.net (John)
Injection-Date: Sat, 10 Sep 2022 14:13:48 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2080
 by: John - Sat, 10 Sep 2022 14:13 UTC

In the case that OUT_OF_RANGE is therefore indicating whether a value is representable, not if it is allowable strictly applying the symmetric number model then there are reasonable work-arounds as only a logical is returned, but perhaps an option like SYMMETRIC_MODEL=.true. would be nice, as in the case of a one-byte value -128 becomes problematic as has been pointed out in local discussions for functions like ABS, SIGN with a positive second value, and so-on. Given the example in the standard and that the standard does not indicate a symmetic model is the set, but a required subset of acceptable models it appears OUT_OF_RANGE does not quite do what the original author wanted.

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

<ZH1TK.36430$OR4c.25450@fx46.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.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: Re: Clarification requesited on INTEGER range and the OUT_OF_RANGE()
function
Content-Language: en-US
Newsgroups: comp.lang.fortran
References: <1fe182ef-4b0a-49f5-a496-a9ea9aba54f1n@googlegroups.com>
<tfhhfe$ln7$2@newsreader4.netcologne.de>
<35b4133d-79a0-492a-935d-71a7ab46adfdn@googlegroups.com>
<584acb36-fb19-4daf-9661-507237c831a4n@googlegroups.com>
From: nospam@nowhere.org (Ron Shepard)
In-Reply-To: <584acb36-fb19-4daf-9661-507237c831a4n@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 13
Message-ID: <ZH1TK.36430$OR4c.25450@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:04:25 -0500
X-Received-Bytes: 2076
 by: Ron Shepard - Sat, 10 Sep 2022 15:04 UTC

On 9/10/22 9:13 AM, John wrote:
> In the case that OUT_OF_RANGE is therefore indicating whether a value is representable, not if it is allowable strictly applying the symmetric number model then there are reasonable work-arounds as only a logical is returned, but perhaps an option like SYMMETRIC_MODEL=.true. would be nice, as in the case of a one-byte value -128 becomes problematic as has been pointed out in local discussions for functions like ABS, SIGN with a positive second value, and so-on. Given the example in the standard and that the standard does not indicate a symmetic model is the set, but a required subset of acceptable models it appears OUT_OF_RANGE does not quite do what the original author wanted.

I think if the programmer is concerned about working within the integer
model numbers, then just adding ABS() to the argument should work. With
j = -128,

OUT_OF_RANGE(ABS(j),0_int8)

should return .true.. Without the ABS(), it should return .false..

$.02 -Ron Shepard

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

<6fcbf7a4-87b7-4313-80d9-c8aeb663da7bn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:5b10:0:b0:35b:b8ed:987 with SMTP id m16-20020ac85b10000000b0035bb8ed0987mr3834140qtw.538.1663024581691;
Mon, 12 Sep 2022 16:16:21 -0700 (PDT)
X-Received: by 2002:a05:620a:752:b0:6cd:d01f:9ae8 with SMTP id
i18-20020a05620a075200b006cdd01f9ae8mr11847820qki.647.1663024581576; Mon, 12
Sep 2022 16:16:21 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Mon, 12 Sep 2022 16:16:21 -0700 (PDT)
In-Reply-To: <ZH1TK.36430$OR4c.25450@fx46.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:4cd0:36c3:5d86:cc63;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:4cd0:36c3:5d86:cc63
References: <1fe182ef-4b0a-49f5-a496-a9ea9aba54f1n@googlegroups.com>
<tfhhfe$ln7$2@newsreader4.netcologne.de> <35b4133d-79a0-492a-935d-71a7ab46adfdn@googlegroups.com>
<584acb36-fb19-4daf-9661-507237c831a4n@googlegroups.com> <ZH1TK.36430$OR4c.25450@fx46.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6fcbf7a4-87b7-4313-80d9-c8aeb663da7bn@googlegroups.com>
Subject: Re: Clarification requesited on INTEGER range and the OUT_OF_RANGE() function
From: gah4@u.washington.edu (gah4)
Injection-Date: Mon, 12 Sep 2022 23:16:21 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 47
 by: gah4 - Mon, 12 Sep 2022 23:16 UTC

On Saturday, September 10, 2022 at 8:04:29 AM UTC-7, Ron Shepard wrote:

(snip)

> I think if the programmer is concerned about working within the integer
> model numbers, then just adding ABS() to the argument should work. With
> j = -128,
> OUT_OF_RANGE(ABS(j),0_int8)
> should return .true.. Without the ABS(), it should return .false..
It seems that much of the reason behind OUT_OF_RANGE is related
to floating point conversion. You can test the value of a REAL expression
and an INTEGER variable that it might fit into.

In the case of INTEGER values, it can be useful if they KIND is different.

One that I get used to in C, and forget in Fortran: In C, all integer
values in expressions are not smaller than int. They are promoted
to int before the operation.

In the original case above:

OUT_OF_RANGE(-1-huge(0))

which I presume should have been:

OUT_OF_RANGE(-1-huge(0),0)

both operands are the same KIND.

Most hardware that is not two's complement will wrap to
some in-range value, and the result will be .false..

To test it, -HUGE(0) has to be converted to a larger KIND,
before subtracting one.

I am not so sure how to find a sufficiently large KIND to do it. Maybe

SELECTED_INTEGER_KIND(DIGITS(0)+1), so:

OUT_OF_RANGE(INTEGER(-HUGE(0),SELECTED_INTEGER_KIND(DIGITS(0)+1)-1,0)

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

<405d8cfa-1c20-4e72-954e-3138e1e0ca4dn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a0c:e24b:0:b0:4a1:d41b:e280 with SMTP id x11-20020a0ce24b000000b004a1d41be280mr25713867qvl.11.1663035384820;
Mon, 12 Sep 2022 19:16:24 -0700 (PDT)
X-Received: by 2002:a05:6214:5185:b0:472:f9b0:cbc6 with SMTP id
kl5-20020a056214518500b00472f9b0cbc6mr24870689qvb.92.1663035384674; Mon, 12
Sep 2022 19:16:24 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Mon, 12 Sep 2022 19:16:24 -0700 (PDT)
In-Reply-To: <6fcbf7a4-87b7-4313-80d9-c8aeb663da7bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=73.40.218.30; posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 73.40.218.30
References: <1fe182ef-4b0a-49f5-a496-a9ea9aba54f1n@googlegroups.com>
<tfhhfe$ln7$2@newsreader4.netcologne.de> <35b4133d-79a0-492a-935d-71a7ab46adfdn@googlegroups.com>
<584acb36-fb19-4daf-9661-507237c831a4n@googlegroups.com> <ZH1TK.36430$OR4c.25450@fx46.iad>
<6fcbf7a4-87b7-4313-80d9-c8aeb663da7bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <405d8cfa-1c20-4e72-954e-3138e1e0ca4dn@googlegroups.com>
Subject: Re: Clarification requesited on INTEGER range and the OUT_OF_RANGE() function
From: urbanjost@comcast.net (John)
Injection-Date: Tue, 13 Sep 2022 02:16:24 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 51
 by: John - Tue, 13 Sep 2022 02:16 UTC

In our routine we take a class(*) variable and promote it to the largest REAL type available and then compare it to the symmetric range of the type and kind from the second value assuming that the model requires -HUGE to HUGE to be valid values, checking for Inf and NAN input values, basically. The promotion is done using something that started from the M_anything module https://github.com/urbanjost/M_anything

> pure elemental function anyscalar_to_real128(valuein) result(d_out)
> implicit none
> $@(#) M_anything::anyscalar_to_real128(3f): convert integer or real parameter of any kind to real128
> class(*),intent(in) :: valuein
> real(kind=real128) :: d_out
> character(len=3),save :: readable='NaN'
> select type(valuein)
> type is (integer(kind=int8)); d_out=real(valuein,kind=real128)
> type is (integer(kind=int16)); d_out=real(valuein,kind=real128)
> type is (integer(kind=int32)); d_out=real(valuein,kind=real128)
> type is (integer(kind=int64)); d_out=real(valuein,kind=real128)
> type is (real(kind=real32)); d_out=real(valuein,kind=real128)
> type is (real(kind=real64)); d_out=real(valuein,kind=real128)
> Type is (real(kind=real128)); d_out=valuein
> type is (logical); d_out=merge(0.0_real128,1.0_real128,valuein)
> type is (character(len=*)); read(valuein,*) d_out
> class default
> !!d_out=huge(0.0_real128)
> read(readable,*)d_out
> !!stop '*M_anything::anyscalar_to_real128: unknown type'
> end select
> end function anyscalar_to_real128

but has since been refined; but basically the C idea of promoting to the largest available is being used so far. Seeing if I can get permission to share the result as it has some "lessons learned" aspects that are interesting; about whether to keep the function pure or not, breaking the promotion up between integer and real, whether to use class(*) or templating. Generalizing it got to be a bit more complex than what the original issue warranted but interesting.

In the original code that started it the ABS() solution would have been fine for that particular usage but it sparked an interest in having a general function that is able to ensure a similar problem does not arise. So for the time being OUT_OF_RANGE is banned! There are a couple of versions still being bandied about; all seem to resolve the issue so performance is expected to be the tie-breaker.

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

<120be120-67c9-4fcb-8a70-cb035ba0ce57n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:21cb:b0:4aa:b039:35c7 with SMTP id d11-20020a05621421cb00b004aab03935c7mr25217833qvh.60.1663048527713;
Mon, 12 Sep 2022 22:55:27 -0700 (PDT)
X-Received: by 2002:ac8:5dd3:0:b0:344:94e6:d667 with SMTP id
e19-20020ac85dd3000000b0034494e6d667mr27546444qtx.409.1663048527605; Mon, 12
Sep 2022 22:55:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.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: Mon, 12 Sep 2022 22:55:27 -0700 (PDT)
In-Reply-To: <405d8cfa-1c20-4e72-954e-3138e1e0ca4dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:506a:da76:cc64:e1d;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:506a:da76:cc64:e1d
References: <1fe182ef-4b0a-49f5-a496-a9ea9aba54f1n@googlegroups.com>
<tfhhfe$ln7$2@newsreader4.netcologne.de> <35b4133d-79a0-492a-935d-71a7ab46adfdn@googlegroups.com>
<584acb36-fb19-4daf-9661-507237c831a4n@googlegroups.com> <ZH1TK.36430$OR4c.25450@fx46.iad>
<6fcbf7a4-87b7-4313-80d9-c8aeb663da7bn@googlegroups.com> <405d8cfa-1c20-4e72-954e-3138e1e0ca4dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <120be120-67c9-4fcb-8a70-cb035ba0ce57n@googlegroups.com>
Subject: Re: Clarification requesited on INTEGER range and the OUT_OF_RANGE() function
From: gah4@u.washington.edu (gah4)
Injection-Date: Tue, 13 Sep 2022 05:55:27 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2212
 by: gah4 - Tue, 13 Sep 2022 05:55 UTC

On Monday, September 12, 2022 at 7:16:26 PM UTC-7, John wrote:

(snip)

> but has since been refined; but basically the C idea of promoting to the largest available is being used so far.

C promotes smaller types to int, but not to long.

Single character constants, such as 'x', are int. (They are char in C++.)
enum constants are also int.

K&R C did all floating point in double precision, all constants were
double precision, and all arithmetic functions only came in
double precision. ANSI allowed some float (single precision),
but constants without f are double. And many people declare
all variables double unless there is a reason to do otherwise.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor