Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Delta: We're Amtrak with wings. -- David Letterman


devel / comp.lang.fortran / Can a named-constant in a complex-literal-constant have rank > 0?

SubjectAuthor
* Can a named-constant in a complex-literal-constant have rank > 0?Peter Klausler US
+* Re: Can a named-constant in a complex-literal-constant have rank > 0?jfh
|`* Re: Can a named-constant in a complex-literal-constant have rank > 0?jfh
| +* Re: Can a named-constant in a complex-literal-constant have rank > 0?Peter Klausler US
| |`* Re: Can a named-constant in a complex-literal-constant have rank > 0?Steven G. Kargl
| | `- Re: Can a named-constant in a complex-literal-constant have rank > 0?Peter Klausler US
| +* Re: Can a named-constant in a complex-literal-constant have rank > 0?FortranFan
| |`- Re: Can a named-constant in a complex-literal-constant have rank > 0?Peter Klausler US
| `- Re: Can a named-constant in a complex-literal-constant have rank > 0?Steven G. Kargl
`* Re: Can a named-constant in a complex-literal-constant have rank > 0?Steve Lionel
 +* Re: Can a named-constant in a complex-literal-constant have rank > 0?Peter Klausler US
 |`- Re: Can a named-constant in a complex-literal-constant have rank > 0?Peter Klausler US
 `* Re: Can a named-constant in a complex-literal-constant have rank > 0?jfh
  `* Re: Can a named-constant in a complex-literal-constant have rank > 0?John
   +- Re: Can a named-constant in a complex-literal-constant have rank > 0?John
   `* Re: Can a named-constant in a complex-literal-constant have rank > 0?John
    `* Re: Can a named-constant in a complex-literal-constant have rank > 0?Steve Lionel
     +- Re: Can a named-constant in a complex-literal-constant have rank > 0?John
     `* Re: Can a named-constant in a complex-literal-constant have rank > 0?John
      +* Re: Can a named-constant in a complex-literal-constant have rank > 0?Steve Lionel
      |+* Re: Can a named-constant in a complex-literal-constant have rank > 0?John
      ||`* Re: Can a named-constant in a complex-literal-constant have rank > 0?John
      || `- Re: Can a named-constant in a complex-literal-constant have rank > 0?gah4
      |+* Re: Can a named-constant in a complex-literal-constant have rank > 0?Robin Vowels
      ||`- Re: Can a named-constant in a complex-literal-constant have rank > 0?gah4
      |`* Re: Can a named-constant in a complex-literal-constant have rank > 0?Peter Klausler US
      | `* Re: Can a named-constant in a complex-literal-constant have rank > 0?Steve Lionel
      |  `* Re: Can a named-constant in a complex-literal-constant have rank > 0?John
      |   `* Re: Can a named-constant in a complex-literal-constant have rank > 0?Steven G. Kargl
      |    `* Re: Can a named-constant in a complex-literal-constant have rank > 0?John
      |     `* Re: Can a named-constant in a complex-literal-constant have rank > 0?Steve Lionel
      |      `* Re: Can a named-constant in a complex-literal-constant have rank > 0?jfh
      |       `* Re: Can a named-constant in a complex-literal-constant have rank > 0?John
      |        `* Re: Can a named-constant in a complex-literal-constant have rank > 0?Steve Lionel
      |         `- Re: Can a named-constant in a complex-literal-constant have rank > 0?John
      `* Re: Can a named-constant in a complex-literal-constant have rank > 0?gah4
       `- Re: Can a named-constant in a complex-literal-constant have rank > 0?John

Pages:12
Can a named-constant in a complex-literal-constant have rank > 0?

<fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a0c:f84b:0:b0:4bb:92b0:3860 with SMTP id g11-20020a0cf84b000000b004bb92b03860mr23009311qvo.61.1667417544145;
Wed, 02 Nov 2022 12:32:24 -0700 (PDT)
X-Received: by 2002:ac8:5a02:0:b0:39e:209e:7177 with SMTP id
n2-20020ac85a02000000b0039e209e7177mr21677505qta.409.1667417543978; Wed, 02
Nov 2022 12:32:23 -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: Wed, 2 Nov 2022 12:32:23 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=12.154.207.45; posting-account=ZT-cAwoAAACx2tBPXm-WZoHIT8sjnGGy
NNTP-Posting-Host: 12.154.207.45
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
Subject: Can a named-constant in a complex-literal-constant have rank > 0?
From: pklausler@nvidia.com (Peter Klausler US)
Injection-Date: Wed, 02 Nov 2022 19:32:24 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1679
 by: Peter Klausler US - Wed, 2 Nov 2022 19:32 UTC

C718 requires that a named-constant that is used as the real-part or imag-part of a complex-literal-constant have a real or integer type, but it doesn't say anything about its rank. Some compilers allow an array-valued named constant to appear, others do not. For example:

real, parameter :: arr2(2) = [1., 2.]
print *, (arr2, 3.)

Is there language anywhere else in the standard that requires such a named-constant to be scalar, or that implies such a constraint because a complex-literal-constant is assumed to be scalar? I can't find anything definitive one way or another.

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<ebc4bac3-a248-4d49-bbe0-2e2103fb04a3n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:59cb:0:b0:39a:dbc7:2424 with SMTP id f11-20020ac859cb000000b0039adbc72424mr21384818qtf.304.1667421157662;
Wed, 02 Nov 2022 13:32:37 -0700 (PDT)
X-Received: by 2002:a05:6214:5088:b0:4bb:a8bc:6332 with SMTP id
kk8-20020a056214508800b004bba8bc6332mr23050317qvb.63.1667421157484; Wed, 02
Nov 2022 13:32:37 -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: Wed, 2 Nov 2022 13:32:37 -0700 (PDT)
In-Reply-To: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=115.189.130.50; posting-account=KnYfEgoAAAD1tUJTvdAUZ3XojNa5tezZ
NNTP-Posting-Host: 115.189.130.50
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ebc4bac3-a248-4d49-bbe0-2e2103fb04a3n@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: harperjf2@gmail.com (jfh)
Injection-Date: Wed, 02 Nov 2022 20:32:37 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2136
 by: jfh - Wed, 2 Nov 2022 20:32 UTC

On Thursday, November 3, 2022 at 8:32:26 AM UTC+13, Peter Klausler US wrote:
> C718 requires that a named-constant that is used as the real-part or imag-part of a complex-literal-constant have a real or integer type, but it doesn't say anything about its rank. Some compilers allow an array-valued named constant to appear, others do not. For example:
>
> real, parameter :: arr2(2) = [1., 2.]
> print *, (arr2, 3.)
>
> Is there language anywhere else in the standard that requires such a named-constant to be scalar, or that implies such a constraint because a complex-literal-constant is assumed to be scalar? I can't find anything definitive one way or another.

It seems that it can be an array but not a coarray. In the F2018 standard, R719 and R720 say the real-part and imag-part
may be named constants, and 8.5.13 allows named constants that are arrays but not coarrays.

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<21a0adae-7a6a-4dd3-bbab-15d12e82a486n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:242a:b0:4bb:96d3:e92d with SMTP id gy10-20020a056214242a00b004bb96d3e92dmr23476301qvb.7.1667422531776;
Wed, 02 Nov 2022 13:55:31 -0700 (PDT)
X-Received: by 2002:a05:6214:62f:b0:4bb:ea3c:a56 with SMTP id
a15-20020a056214062f00b004bbea3c0a56mr17552201qvx.52.1667422531643; Wed, 02
Nov 2022 13:55:31 -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: Wed, 2 Nov 2022 13:55:31 -0700 (PDT)
In-Reply-To: <ebc4bac3-a248-4d49-bbe0-2e2103fb04a3n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=115.189.130.50; posting-account=KnYfEgoAAAD1tUJTvdAUZ3XojNa5tezZ
NNTP-Posting-Host: 115.189.130.50
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com> <ebc4bac3-a248-4d49-bbe0-2e2103fb04a3n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <21a0adae-7a6a-4dd3-bbab-15d12e82a486n@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: harperjf2@gmail.com (jfh)
Injection-Date: Wed, 02 Nov 2022 20:55:31 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2692
 by: jfh - Wed, 2 Nov 2022 20:55 UTC

On Thursday, November 3, 2022 at 9:32:39 AM UTC+13, jfh wrote:
> On Thursday, November 3, 2022 at 8:32:26 AM UTC+13, Peter Klausler US wrote:
> > C718 requires that a named-constant that is used as the real-part or imag-part of a complex-literal-constant have a real or integer type, but it doesn't say anything about its rank. Some compilers allow an array-valued named constant to appear, others do not. For example:
> >
> > real, parameter :: arr2(2) = [1., 2.]
> > print *, (arr2, 3.)
> >
> > Is there language anywhere else in the standard that requires such a named-constant to be scalar, or that implies such a constraint because a complex-literal-constant is assumed to be scalar? I can't find anything definitive one way or another.
> It seems that it can be an array but not a coarray. In the F2018 standard, R719 and R720 say the real-part and imag-part
> may be named constants, and 8.5.13 allows named constants that are arrays but not coarrays.

But the gfortran developers know Fortran better than I do and gfortran gives the error message
3 | print *, (arr2, 3.)
| 1
Error: Scalar PARAMETER required in complex constant at (1)

Ifort compiles and runs Klausler's program but prints the wrong answer:
(0.0000000E+00,3.000000)

Does any compiler print the hoped-for (1.000000,3.000000) and (2.000000,3.000000) ?

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<133e031a-f811-4f39-b83c-7c8a2ed56e79n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:2a47:b0:4bb:5bc0:626d with SMTP id jf7-20020a0562142a4700b004bb5bc0626dmr23623428qvb.130.1667427593352;
Wed, 02 Nov 2022 15:19:53 -0700 (PDT)
X-Received: by 2002:a05:620a:280e:b0:6a6:ee16:8c78 with SMTP id
f14-20020a05620a280e00b006a6ee168c78mr19289569qkp.122.1667427593209; Wed, 02
Nov 2022 15:19:53 -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: Wed, 2 Nov 2022 15:19:53 -0700 (PDT)
In-Reply-To: <21a0adae-7a6a-4dd3-bbab-15d12e82a486n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=12.154.207.45; posting-account=ZT-cAwoAAACx2tBPXm-WZoHIT8sjnGGy
NNTP-Posting-Host: 12.154.207.45
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<ebc4bac3-a248-4d49-bbe0-2e2103fb04a3n@googlegroups.com> <21a0adae-7a6a-4dd3-bbab-15d12e82a486n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <133e031a-f811-4f39-b83c-7c8a2ed56e79n@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: pklausler@nvidia.com (Peter Klausler US)
Injection-Date: Wed, 02 Nov 2022 22:19:53 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1475
 by: Peter Klausler US - Wed, 2 Nov 2022 22:19 UTC

On Wednesday, November 2, 2022 at 1:55:33 PM UTC-7, jfh wrote:
> Does any compiler print the hoped-for (1.000000,3.000000) and (2.000000,3.000000) ?

f18 prints " (1.,3.) (2.,3.)".

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<b144f1e7-044a-4203-b86e-4bc78120192an@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:7558:0:b0:3a5:44d0:ef6d with SMTP id b24-20020ac87558000000b003a544d0ef6dmr5205084qtr.376.1667433456955;
Wed, 02 Nov 2022 16:57:36 -0700 (PDT)
X-Received: by 2002:ad4:5dee:0:b0:4b4:b8a:78db with SMTP id
jn14-20020ad45dee000000b004b40b8a78dbmr24283001qvb.12.1667433456587; Wed, 02
Nov 2022 16:57:36 -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: Wed, 2 Nov 2022 16:57:36 -0700 (PDT)
In-Reply-To: <21a0adae-7a6a-4dd3-bbab-15d12e82a486n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=136.226.51.0; posting-account=ZZXq9AoAAAAQEcA7zKAGm0UFQh4gMBv7
NNTP-Posting-Host: 136.226.51.0
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<ebc4bac3-a248-4d49-bbe0-2e2103fb04a3n@googlegroups.com> <21a0adae-7a6a-4dd3-bbab-15d12e82a486n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b144f1e7-044a-4203-b86e-4bc78120192an@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: parekhvs@gmail.com (FortranFan)
Injection-Date: Wed, 02 Nov 2022 23:57:36 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 15
 by: FortranFan - Wed, 2 Nov 2022 23:57 UTC

On Wednesday, November 2, 2022 at 4:55:33 PM UTC-4, jfh wrote:

> ..
> Does any compiler print the hoped-for (1.000000,3.000000) and (2.000000,3..000000) ?

Rather than the "hoped for", chances are high the Fortran committee will think the standard needs a quick fix here.

That is, the equivalent of R719 and R720 in the revised document be updated to state something like "scalar named-constant" instead of leaving it as "named-constant." Which will be welcome for gfortran and any other compiler that issues a similar compile-time error.

OP can directly seek clarification on this at the J3 Fortran mailing list. Or have a colleague at Nvidia do so.

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<tjv15u$198de$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: sgk@REMOVEtroutmask.apl.washington.edu (Steven G. Kargl)
Newsgroups: comp.lang.fortran
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
Date: Thu, 3 Nov 2022 00:14:54 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <tjv15u$198de$1@dont-email.me>
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<ebc4bac3-a248-4d49-bbe0-2e2103fb04a3n@googlegroups.com>
<21a0adae-7a6a-4dd3-bbab-15d12e82a486n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 3 Nov 2022 00:14:54 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="9994beceb4944eb1f7a636635e735b19";
logging-data="1352110"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Y2U0lhRT83l8zfyoI5xDY"
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
Cancel-Lock: sha1:/SMzLdYL+OZ10fY4Osak2nE91l4=
 by: Steven G. Kargl - Thu, 3 Nov 2022 00:14 UTC

On Wed, 02 Nov 2022 13:55:31 -0700, jfh wrote:

> On Thursday, November 3, 2022 at 9:32:39 AM UTC+13, jfh wrote:
>> On Thursday, November 3, 2022 at 8:32:26 AM UTC+13, Peter Klausler US wrote:
>> > C718 requires that a named-constant that is used as the real-part or imag-part of a complex-literal-constant have a real or integer type, but it doesn't say anything about its rank. Some compilers allow an array-valued named constant to appear, others do not. For example:
>> >
>> > real, parameter :: arr2(2) = [1., 2.]
>> > print *, (arr2, 3.)
>> >
>> > Is there language anywhere else in the standard that requires such a named-constant to be scalar, or that implies such a constraint because a complex-literal-constant is assumed to be scalar? I can't find anything definitive one way or another.
>> It seems that it can be an array but not a coarray. In the F2018 standard, R719 and R720 say the real-part and imag-part
>> may be named constants, and 8.5.13 allows named constants that are arrays but not coarrays.
>
> But the gfortran developers know Fortran better than I do and gfortran gives the error message
> 3 | print *, (arr2, 3.)
> | 1
> Error: Scalar PARAMETER required in complex constant at (1)

gfortran started life as Fortran 95 compilers. Named-constants
were not permitted in a complex literal-constant. The above
error could be hold over from days past.

I was going to argument that one might be imposing some rule
for cmplx(arr2,3.) to the above, but there doesn't appear to
a rule that the real and imaginary parts are conformable.

It seems Peter has stumbled on an oversight.

--
steve

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<tjv1au$198de$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!aioe.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: sgk@REMOVEtroutmask.apl.washington.edu (Steven G. Kargl)
Newsgroups: comp.lang.fortran
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
Date: Thu, 3 Nov 2022 00:17:34 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <tjv1au$198de$2@dont-email.me>
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<ebc4bac3-a248-4d49-bbe0-2e2103fb04a3n@googlegroups.com>
<21a0adae-7a6a-4dd3-bbab-15d12e82a486n@googlegroups.com>
<133e031a-f811-4f39-b83c-7c8a2ed56e79n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 3 Nov 2022 00:17:34 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="9994beceb4944eb1f7a636635e735b19";
logging-data="1352110"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18jEdsz/yTcdRHDDODSP1Pu"
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
Cancel-Lock: sha1:tQqptSaGFQdqI3puuaREQwF7ir0=
 by: Steven G. Kargl - Thu, 3 Nov 2022 00:17 UTC

On Wed, 02 Nov 2022 15:19:53 -0700, Peter Klausler US wrote:

> On Wednesday, November 2, 2022 at 1:55:33 PM UTC-7, jfh wrote:
>> Does any compiler print the hoped-for (1.000000,3.000000) and (2.000000,3.000000) ?
>
> f18 prints " (1.,3.) (2.,3.)".

What happens if you do

program foo
real, parameter :: a(2) = [1,2], b(3) = [1,2,3]
print *, (a,b)
end program foo

gfortran gives the same 'Scalar PARAMETER ...' error.
In your case, arr2 and 3. are conformable.

--
steve

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<7fd662bd-dfc5-4252-b81c-4b108bb82dafn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a37:48c:0:b0:6f8:70d5:9a41 with SMTP id 134-20020a37048c000000b006f870d59a41mr19644693qke.676.1667434822988;
Wed, 02 Nov 2022 17:20:22 -0700 (PDT)
X-Received: by 2002:ac8:6b06:0:b0:3a5:4879:7e1c with SMTP id
w6-20020ac86b06000000b003a548797e1cmr4028417qts.268.1667434822738; Wed, 02
Nov 2022 17:20:22 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.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: Wed, 2 Nov 2022 17:20:22 -0700 (PDT)
In-Reply-To: <b144f1e7-044a-4203-b86e-4bc78120192an@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=12.154.207.45; posting-account=ZT-cAwoAAACx2tBPXm-WZoHIT8sjnGGy
NNTP-Posting-Host: 12.154.207.45
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<ebc4bac3-a248-4d49-bbe0-2e2103fb04a3n@googlegroups.com> <21a0adae-7a6a-4dd3-bbab-15d12e82a486n@googlegroups.com>
<b144f1e7-044a-4203-b86e-4bc78120192an@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7fd662bd-dfc5-4252-b81c-4b108bb82dafn@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: pklausler@nvidia.com (Peter Klausler US)
Injection-Date: Thu, 03 Nov 2022 00:20:22 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1869
 by: Peter Klausler US - Thu, 3 Nov 2022 00:20 UTC

On Wednesday, November 2, 2022 at 4:57:38 PM UTC-7, FortranFan wrote:
> Rather than the "hoped for", chances are high the Fortran committee will think the standard needs a quick fix here.

Thanks, but I think that I have what I need in order to classify this feature in the f18 documentation at https://github.com/llvm/llvm-project/blob/main/flang/docs/Extensions.md -- I wasn't sure whether it was an "extension" or a "standard feature that might as well not be".

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<f18546e3-aa0d-4c15-8165-28aa7c395a3en@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ad4:5bcf:0:b0:4bb:df96:905a with SMTP id t15-20020ad45bcf000000b004bbdf96905amr20280088qvt.18.1667435019388;
Wed, 02 Nov 2022 17:23:39 -0700 (PDT)
X-Received: by 2002:ac8:5a02:0:b0:39e:209e:7177 with SMTP id
n2-20020ac85a02000000b0039e209e7177mr22979265qta.409.1667435019227; Wed, 02
Nov 2022 17:23:39 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.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: Wed, 2 Nov 2022 17:23:38 -0700 (PDT)
In-Reply-To: <tjv1au$198de$2@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=12.154.207.45; posting-account=ZT-cAwoAAACx2tBPXm-WZoHIT8sjnGGy
NNTP-Posting-Host: 12.154.207.45
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<ebc4bac3-a248-4d49-bbe0-2e2103fb04a3n@googlegroups.com> <21a0adae-7a6a-4dd3-bbab-15d12e82a486n@googlegroups.com>
<133e031a-f811-4f39-b83c-7c8a2ed56e79n@googlegroups.com> <tjv1au$198de$2@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f18546e3-aa0d-4c15-8165-28aa7c395a3en@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: pklausler@nvidia.com (Peter Klausler US)
Injection-Date: Thu, 03 Nov 2022 00:23:39 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1741
 by: Peter Klausler US - Thu, 3 Nov 2022 00:23 UTC

On Wednesday, November 2, 2022 at 5:17:37 PM UTC-7, Steven G. Kargl wrote:
> > f18 prints " (1.,3.) (2.,3.)".
> What happens if you do
>
> program foo
> real, parameter :: a(2) = [1,2], b(3) = [1,2,3]
> print *, (a,b)
> end program foo

./t2.f90:3:10: error: Dimension 1 of left operand has extent 2, but right operand has extent 3
print *, (a,b)
^^^^^

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<jsgh44F17h5U1@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: steve@seesignature.invalid (Steve Lionel)
Newsgroups: comp.lang.fortran
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
Date: Wed, 2 Nov 2022 20:42:44 -0400
Lines: 30
Message-ID: <jsgh44F17h5U1@mid.individual.net>
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net jPfMkeLCaY64CL37W17MXw8UfoptO/39L5uqR5/2gMkkQh/aGG
Cancel-Lock: sha1:obazu5llQsH5GYEnnKzuI42pKPc=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101
Thunderbird/107.0
Content-Language: en-US
In-Reply-To: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
 by: Steve Lionel - Thu, 3 Nov 2022 00:42 UTC

On 11/2/2022 3:32 PM, Peter Klausler US wrote:
> C718 requires that a named-constant that is used as the real-part or imag-part of a complex-literal-constant have a real or integer type, but it doesn't say anything about its rank. Some compilers allow an array-valued named constant to appear, others do not. For example:
>
> real, parameter :: arr2(2) = [1., 2.]
> print *, (arr2, 3.)
>
> Is there language anywhere else in the standard that requires such a named-constant to be scalar, or that implies such a constraint because a complex-literal-constant is assumed to be scalar? I can't find anything definitive one way or another.

(I realize I meant to do a follow-up to the group and instead sent an
email to Peter...)

NAG Fortran does not accept this code. I can't find words in the
standard that either prohibit it, or assign it an interpretation.
Malcolm would say that means it's not allowed. I have asked him for his
thoughts, and suggested that a constraint should be added to require
that both parts be scalar (which NAG evidently believes is the rule.)

Another possibility, which I don't like but Peter seems to want, is that
if both are arrays that they be the same shape and if only one is scalar
that it gets duplicated to the shape of the other. This feels messy to me.
--
Steve Lionel
ISO/IEC JTC1/SC22/WG5 (Fortran) Convenor
Retired Intel Fortran developer/support
Email: firstname at firstnamelastname dot com
Twitter: @DoctorFortran
LinkedIn: https://www.linkedin.com/in/stevelionel
Blog: https://stevelionel.com/drfortran
WG5: https://wg5-fortran.org

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<b8382965-eba4-4b6b-9684-f2b15494a1e0n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:5c8b:0:b0:39b:ff53:bb57 with SMTP id r11-20020ac85c8b000000b0039bff53bb57mr22378647qta.293.1667437419303;
Wed, 02 Nov 2022 18:03:39 -0700 (PDT)
X-Received: by 2002:ac8:5f11:0:b0:39c:b7c7:e227 with SMTP id
x17-20020ac85f11000000b0039cb7c7e227mr22229348qta.196.1667437419144; Wed, 02
Nov 2022 18:03:39 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.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: Wed, 2 Nov 2022 18:03:38 -0700 (PDT)
In-Reply-To: <jsgh44F17h5U1@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=12.154.207.45; posting-account=ZT-cAwoAAACx2tBPXm-WZoHIT8sjnGGy
NNTP-Posting-Host: 12.154.207.45
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com> <jsgh44F17h5U1@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b8382965-eba4-4b6b-9684-f2b15494a1e0n@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: pklausler@nvidia.com (Peter Klausler US)
Injection-Date: Thu, 03 Nov 2022 01:03:39 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2205
 by: Peter Klausler US - Thu, 3 Nov 2022 01:03 UTC

On Wednesday, November 2, 2022 at 5:42:48 PM UTC-7, Steve Lionel wrote:
> Another possibility, which I don't like but Peter seems to want, is that
> if both are arrays that they be the same shape and if only one is scalar
> that it gets duplicated to the shape of the other. This feels messy to me.

Many Fortran compilers support an extension feature "(a,b)" that is a generalized
complex constructor -- basically equivalent to CMPLX(a,b) except that the imaginary
part 'b' can't be a non-present optional dummy argument and the result type's kind being
automatically determined as it would be for "a+b". So some ordered pairs are
standard-conforming complex-literal-constants, and others are extension complex
constructors. The classification of the case in which one or both parts was a named
constant array is not clear, but it's either a complex-literal-constant or an extension
complex constructor to f18, and the result is the same either way, with the distinction
just being one of documentation.

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<0a0f212b-2a40-464a-84ff-c7a2f284bc97n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:2a47:b0:4bb:5bc0:626d with SMTP id jf7-20020a0562142a4700b004bb5bc0626dmr27662311qvb.130.1667495095673;
Thu, 03 Nov 2022 10:04:55 -0700 (PDT)
X-Received: by 2002:a05:6214:5088:b0:4bb:a8bc:6332 with SMTP id
kk8-20020a056214508800b004bba8bc6332mr27460680qvb.63.1667495095409; Thu, 03
Nov 2022 10:04:55 -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: Thu, 3 Nov 2022 10:04:55 -0700 (PDT)
In-Reply-To: <b8382965-eba4-4b6b-9684-f2b15494a1e0n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=12.154.207.45; posting-account=ZT-cAwoAAACx2tBPXm-WZoHIT8sjnGGy
NNTP-Posting-Host: 12.154.207.45
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<jsgh44F17h5U1@mid.individual.net> <b8382965-eba4-4b6b-9684-f2b15494a1e0n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0a0f212b-2a40-464a-84ff-c7a2f284bc97n@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: pklausler@nvidia.com (Peter Klausler US)
Injection-Date: Thu, 03 Nov 2022 17:04:55 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1407
 by: Peter Klausler US - Thu, 3 Nov 2022 17:04 UTC

A briefer way to explain "(a,b)" when it's not a complex-literal-constant is "(a)+(0,1)*(b)" with a & b constrained to be real or integer.

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<fd998593-d11b-4347-a40c-c71a2ae806d4n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:4645:0:b0:3a5:2a3c:807a with SMTP id f5-20020ac84645000000b003a52a3c807amr23876968qto.651.1667635856394;
Sat, 05 Nov 2022 01:10:56 -0700 (PDT)
X-Received: by 2002:a05:622a:170d:b0:3a5:e6b:641d with SMTP id
h13-20020a05622a170d00b003a50e6b641dmr32278826qtk.449.1667635856135; Sat, 05
Nov 2022 01:10:56 -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, 5 Nov 2022 01:10:55 -0700 (PDT)
In-Reply-To: <jsgh44F17h5U1@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=115.189.135.194; posting-account=KnYfEgoAAAD1tUJTvdAUZ3XojNa5tezZ
NNTP-Posting-Host: 115.189.135.194
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com> <jsgh44F17h5U1@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fd998593-d11b-4347-a40c-c71a2ae806d4n@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: harperjf2@gmail.com (jfh)
Injection-Date: Sat, 05 Nov 2022 08:10:56 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3459
 by: jfh - Sat, 5 Nov 2022 08:10 UTC

On Thursday, November 3, 2022 at 1:42:48 PM UTC+13, Steve Lionel wrote:
> On 11/2/2022 3:32 PM, Peter Klausler US wrote:
> > C718 requires that a named-constant that is used as the real-part or imag-part of a complex-literal-constant have a real or integer type, but it doesn't say anything about its rank. Some compilers allow an array-valued named constant to appear, others do not. For example:
> >
> > real, parameter :: arr2(2) = [1., 2.]
> > print *, (arr2, 3.)
> >
> > Is there language anywhere else in the standard that requires such a named-constant to be scalar, or that implies such a constraint because a complex-literal-constant is assumed to be scalar? I can't find anything definitive one way or another.
> (I realize I meant to do a follow-up to the group and instead sent an
> email to Peter...)
>
> NAG Fortran does not accept this code. I can't find words in the
> standard that either prohibit it, or assign it an interpretation.
> Malcolm would say that means it's not allowed. I have asked him for his
> thoughts, and suggested that a constraint should be added to require
> that both parts be scalar (which NAG evidently believes is the rule.)
>
> Another possibility, which I don't like but Peter seems to want, is that
> if both are arrays that they be the same shape and if only one is scalar
> that it gets duplicated to the shape of the other. This feels messy to me..
> --
> Steve Lionel
> ISO/IEC JTC1/SC22/WG5 (Fortran) Convenor
> Retired Intel Fortran developer/support
> Email: firstname at firstnamelastname dot com
> Twitter: @DoctorFortran
> LinkedIn: https://www.linkedin.com/in/stevelionel
> Blog: https://stevelionel.com/drfortran
> WG5: https://wg5-fortran.org

The possibility that Peter wants and Steve thinks is messy is exactly what the cmplx intrinsic allows. Both the compilers I can use, ifort and gfortran, are happy with this program.

complex,parameter:: c(2) = cmplx([1.0,2.0], 3.0)
print *, c
end program

Of course both those compilers object, in different ways, if the word cmplx is removed from the above program.

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<06e26022-6faf-452c-8c34-df6e8f9a1994n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:5d89:0:b0:3a4:f465:9434 with SMTP id d9-20020ac85d89000000b003a4f4659434mr33852194qtx.459.1667680793586;
Sat, 05 Nov 2022 13:39:53 -0700 (PDT)
X-Received: by 2002:ac8:4256:0:b0:3a4:fd1c:a5ca with SMTP id
r22-20020ac84256000000b003a4fd1ca5camr34507812qtm.77.1667680793336; Sat, 05
Nov 2022 13:39:53 -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, 5 Nov 2022 13:39:53 -0700 (PDT)
In-Reply-To: <fd998593-d11b-4347-a40c-c71a2ae806d4n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:546:300:4c20:f8cb:3824:2b02:1333;
posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 2601:546:300:4c20:f8cb:3824:2b02:1333
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<jsgh44F17h5U1@mid.individual.net> <fd998593-d11b-4347-a40c-c71a2ae806d4n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <06e26022-6faf-452c-8c34-df6e8f9a1994n@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: urbanjost@comcast.net (John)
Injection-Date: Sat, 05 Nov 2022 20:39:53 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4428
 by: John - Sat, 5 Nov 2022 20:39 UTC

On Saturday, November 5, 2022 at 4:10:57 AM UTC-4, jfh wrote:
> On Thursday, November 3, 2022 at 1:42:48 PM UTC+13, Steve Lionel wrote:
> > On 11/2/2022 3:32 PM, Peter Klausler US wrote:
> > > C718 requires that a named-constant that is used as the real-part or imag-part of a complex-literal-constant have a real or integer type, but it doesn't say anything about its rank. Some compilers allow an array-valued named constant to appear, others do not. For example:
> > >
> > > real, parameter :: arr2(2) = [1., 2.]
> > > print *, (arr2, 3.)
> > >
> > > Is there language anywhere else in the standard that requires such a named-constant to be scalar, or that implies such a constraint because a complex-literal-constant is assumed to be scalar? I can't find anything definitive one way or another.
> > (I realize I meant to do a follow-up to the group and instead sent an
> > email to Peter...)
> >
> > NAG Fortran does not accept this code. I can't find words in the
> > standard that either prohibit it, or assign it an interpretation.
> > Malcolm would say that means it's not allowed. I have asked him for his
> > thoughts, and suggested that a constraint should be added to require
> > that both parts be scalar (which NAG evidently believes is the rule.)
> >
> > Another possibility, which I don't like but Peter seems to want, is that
> > if both are arrays that they be the same shape and if only one is scalar
> > that it gets duplicated to the shape of the other. This feels messy to me.
> > --
> > Steve Lionel
> > ISO/IEC JTC1/SC22/WG5 (Fortran) Convenor
> > Retired Intel Fortran developer/support
> > Email: firstname at firstnamelastname dot com
> > Twitter: @DoctorFortran
> > LinkedIn: https://www.linkedin.com/in/stevelionel
> > Blog: https://stevelionel.com/drfortran
> > WG5: https://wg5-fortran.org
> The possibility that Peter wants and Steve thinks is messy is exactly what the cmplx intrinsic allows. Both the compilers I can use, ifort and gfortran, are happy with this program.
>
> complex,parameter:: c(2) = cmplx([1.0,2.0], 3.0)
> print *, c
> end program
>
> Of course both those compilers object, in different ways, if the word cmplx is removed from the above program.

I have generally thought of (x,y) as equivalent to cmplx(x,y) without the issues with kind that cmplx() has with the restriction that the values are constant; and being that CMPLX is an elemental function I would have expected the same behavior between the two, personally. I also found it confusing in the past I could do

real,parameter :: x=3.0*3.0, y=sin(10.0)
complex :: z=(x,y)
complex :: zz=cmplx(3.0*3.0,sin(10.0))

but not

complex,parameter :: zzz=(3.0*3.0,sin(10.0))

as well, so I as a rule just use cmplx and always specify the kind anyway, even though it gets pretty verbose. Probably why the COMPLEX function is a common extension!

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<7c373058-eec6-4170-8e5c-3c6b30ea2b77n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:620a:2294:b0:6fa:bb9:f9c0 with SMTP id o20-20020a05620a229400b006fa0bb9f9c0mr31074755qkh.578.1667681324512;
Sat, 05 Nov 2022 13:48:44 -0700 (PDT)
X-Received: by 2002:a05:6214:21ed:b0:4bb:e947:c59a with SMTP id
p13-20020a05621421ed00b004bbe947c59amr32780262qvj.46.1667681324355; Sat, 05
Nov 2022 13:48:44 -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, 5 Nov 2022 13:48:44 -0700 (PDT)
In-Reply-To: <06e26022-6faf-452c-8c34-df6e8f9a1994n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:546:300:4c20:f8cb:3824:2b02:1333;
posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 2601:546:300:4c20:f8cb:3824:2b02:1333
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<jsgh44F17h5U1@mid.individual.net> <fd998593-d11b-4347-a40c-c71a2ae806d4n@googlegroups.com>
<06e26022-6faf-452c-8c34-df6e8f9a1994n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7c373058-eec6-4170-8e5c-3c6b30ea2b77n@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: urbanjost@comcast.net (John)
Injection-Date: Sat, 05 Nov 2022 20:48:44 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4680
 by: John - Sat, 5 Nov 2022 20:48 UTC

On Saturday, November 5, 2022 at 4:39:55 PM UTC-4, John wrote:
> On Saturday, November 5, 2022 at 4:10:57 AM UTC-4, jfh wrote:
> > On Thursday, November 3, 2022 at 1:42:48 PM UTC+13, Steve Lionel wrote:
> > > On 11/2/2022 3:32 PM, Peter Klausler US wrote:
> > > > C718 requires that a named-constant that is used as the real-part or imag-part of a complex-literal-constant have a real or integer type, but it doesn't say anything about its rank. Some compilers allow an array-valued named constant to appear, others do not. For example:
> > > >
> > > > real, parameter :: arr2(2) = [1., 2.]
> > > > print *, (arr2, 3.)
> > > >
> > > > Is there language anywhere else in the standard that requires such a named-constant to be scalar, or that implies such a constraint because a complex-literal-constant is assumed to be scalar? I can't find anything definitive one way or another.
> > > (I realize I meant to do a follow-up to the group and instead sent an
> > > email to Peter...)
> > >
> > > NAG Fortran does not accept this code. I can't find words in the
> > > standard that either prohibit it, or assign it an interpretation.
> > > Malcolm would say that means it's not allowed. I have asked him for his
> > > thoughts, and suggested that a constraint should be added to require
> > > that both parts be scalar (which NAG evidently believes is the rule.)
> > >
> > > Another possibility, which I don't like but Peter seems to want, is that
> > > if both are arrays that they be the same shape and if only one is scalar
> > > that it gets duplicated to the shape of the other. This feels messy to me.
> > > --
> > > Steve Lionel
> > > ISO/IEC JTC1/SC22/WG5 (Fortran) Convenor
> > > Retired Intel Fortran developer/support
> > > Email: firstname at firstnamelastname dot com
> > > Twitter: @DoctorFortran
> > > LinkedIn: https://www.linkedin.com/in/stevelionel
> > > Blog: https://stevelionel.com/drfortran
> > > WG5: https://wg5-fortran.org
> > The possibility that Peter wants and Steve thinks is messy is exactly what the cmplx intrinsic allows. Both the compilers I can use, ifort and gfortran, are happy with this program.
> >
> > complex,parameter:: c(2) = cmplx([1.0,2.0], 3.0)
> > print *, c
> > end program
> >
> > Of course both those compilers object, in different ways, if the word cmplx is removed from the above program.
> I have generally thought of (x,y) as equivalent to cmplx(x,y) without the issues with kind that cmplx() has with the restriction that the values are constant; and being that CMPLX is an elemental function I would have expected the same behavior between the two, personally. I also found it confusing in the past I could do
>
> real,parameter :: x=3.0*3.0, y=sin(10.0)
> complex :: z=(x,y)
> complex :: zz=cmplx(3.0*3.0,sin(10.0))
>
> but not
>
> complex,parameter :: zzz=(3.0*3.0,sin(10.0))
>
> as well, so I as a rule just use cmplx and always specify the kind anyway, even though it gets pretty verbose. Probably why the COMPLEX function is a common extension!

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<5bc2a9c6-8eb7-40cd-8180-3892540ffb2fn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ad4:5b8f:0:b0:4bb:93b9:2196 with SMTP id 15-20020ad45b8f000000b004bb93b92196mr38402362qvp.51.1667681569542;
Sat, 05 Nov 2022 13:52:49 -0700 (PDT)
X-Received: by 2002:a0c:9151:0:b0:4b1:8375:46d3 with SMTP id
q75-20020a0c9151000000b004b1837546d3mr38972076qvq.122.1667681569380; Sat, 05
Nov 2022 13:52:49 -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, 5 Nov 2022 13:52:49 -0700 (PDT)
In-Reply-To: <06e26022-6faf-452c-8c34-df6e8f9a1994n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:546:300:4c20:f8cb:3824:2b02:1333;
posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 2601:546:300:4c20:f8cb:3824:2b02:1333
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<jsgh44F17h5U1@mid.individual.net> <fd998593-d11b-4347-a40c-c71a2ae806d4n@googlegroups.com>
<06e26022-6faf-452c-8c34-df6e8f9a1994n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5bc2a9c6-8eb7-40cd-8180-3892540ffb2fn@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: urbanjost@comcast.net (John)
Injection-Date: Sat, 05 Nov 2022 20:52:49 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 5065
 by: John - Sat, 5 Nov 2022 20:52 UTC

On Saturday, November 5, 2022 at 4:39:55 PM UTC-4, John wrote:
> On Saturday, November 5, 2022 at 4:10:57 AM UTC-4, jfh wrote:
> > On Thursday, November 3, 2022 at 1:42:48 PM UTC+13, Steve Lionel wrote:
> > > On 11/2/2022 3:32 PM, Peter Klausler US wrote:
> > > > C718 requires that a named-constant that is used as the real-part or imag-part of a complex-literal-constant have a real or integer type, but it doesn't say anything about its rank. Some compilers allow an array-valued named constant to appear, others do not. For example:
> > > >
> > > > real, parameter :: arr2(2) = [1., 2.]
> > > > print *, (arr2, 3.)
> > > >
> > > > Is there language anywhere else in the standard that requires such a named-constant to be scalar, or that implies such a constraint because a complex-literal-constant is assumed to be scalar? I can't find anything definitive one way or another.
> > > (I realize I meant to do a follow-up to the group and instead sent an
> > > email to Peter...)
> > >
> > > NAG Fortran does not accept this code. I can't find words in the
> > > standard that either prohibit it, or assign it an interpretation.
> > > Malcolm would say that means it's not allowed. I have asked him for his
> > > thoughts, and suggested that a constraint should be added to require
> > > that both parts be scalar (which NAG evidently believes is the rule.)
> > >
> > > Another possibility, which I don't like but Peter seems to want, is that
> > > if both are arrays that they be the same shape and if only one is scalar
> > > that it gets duplicated to the shape of the other. This feels messy to me.
> > > --
> > > Steve Lionel
> > > ISO/IEC JTC1/SC22/WG5 (Fortran) Convenor
> > > Retired Intel Fortran developer/support
> > > Email: firstname at firstnamelastname dot com
> > > Twitter: @DoctorFortran
> > > LinkedIn: https://www.linkedin.com/in/stevelionel
> > > Blog: https://stevelionel.com/drfortran
> > > WG5: https://wg5-fortran.org
> > The possibility that Peter wants and Steve thinks is messy is exactly what the cmplx intrinsic allows. Both the compilers I can use, ifort and gfortran, are happy with this program.
> >
> > complex,parameter:: c(2) = cmplx([1.0,2.0], 3.0)
> > print *, c
> > end program
> >
> > Of course both those compilers object, in different ways, if the word cmplx is removed from the above program.
> I have generally thought of (x,y) as equivalent to cmplx(x,y) without the issues with kind that cmplx() has with the restriction that the values are constant; and being that CMPLX is an elemental function I would have expected the same behavior between the two, personally. I also found it confusing in the past I could do
>
> real,parameter :: x=3.0*3.0, y=sin(10.0)
> complex :: z=(x,y)
> complex :: zz=cmplx(3.0*3.0,sin(10.0))
>
> but not
>
> complex,parameter :: zzz=(3.0*3.0,sin(10.0))
>
> as well, so I as a rule just use cmplx and always specify the kind anyway, even though it gets pretty verbose. Probably why the COMPLEX function is a common extension!

I just remembered an old argument about how some compilers allowed redundant parenthesis around expressions and how allowing anything but constants would break that, but just tried three compilers and none of them did so maybe that is a moot point. Does anyone know of a compiler that still allows something like "print *, (3+10*3)" printing a scalar integer, for example?

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<jso8ptF894nU1@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: steve@seesignature.invalid (Steve Lionel)
Newsgroups: comp.lang.fortran
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
Date: Sat, 5 Nov 2022 19:09:48 -0400
Lines: 40
Message-ID: <jso8ptF894nU1@mid.individual.net>
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<jsgh44F17h5U1@mid.individual.net>
<fd998593-d11b-4347-a40c-c71a2ae806d4n@googlegroups.com>
<06e26022-6faf-452c-8c34-df6e8f9a1994n@googlegroups.com>
<5bc2a9c6-8eb7-40cd-8180-3892540ffb2fn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net 2Ma/iOcJl7ZUSo7pq60MZArE7zeVgrKHbRM2JtcOHRJWTm54CV
Cancel-Lock: sha1:Kv2go2kZuooWv3YFDGI/PiJn5RU=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101
Thunderbird/107.0
Content-Language: en-US
In-Reply-To: <5bc2a9c6-8eb7-40cd-8180-3892540ffb2fn@googlegroups.com>
 by: Steve Lionel - Sat, 5 Nov 2022 23:09 UTC

On 11/5/2022 4:52 PM, John wrote:
> I just remembered an old argument about how some compilers allowed redundant parenthesis around expressions and how allowing anything but constants would break that, but just tried three compilers and none of them did so maybe that is a moot point. Does anyone know of a compiler that still allows something like "print *, (3+10*3)" printing a scalar integer, for example?

D:\Projects>type t.f90
print *, (3+10*3)
end
D:\Projects>ifort t.f90
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running
on Intel(R) 64, Version 2021.7.0 Build 20220726_000000
Copyright (C) 1985-2022 Intel Corporation. All rights reserved.

Microsoft (R) Incremental Linker Version 14.33.31630.0
Copyright (C) Microsoft Corporation. All rights reserved.

-out:t.exe
-subsystem:console
t.obj

D:\Projects>t.exe
33

D:\Projects>

I recognize the similarity to CMPLX, but am not sure the standard wants
to make complex constants elemental. I'm intending to write a paper and
see what the sense of the committee is on this. For F2023, which is in
the DIS stage, it would be simple to require the real and imaginary
parts to be scalar. Trying to do more at this point would risk
complications that often happen with last-minute expansions of semantics
- and it could be considered for F202Y.
--
Steve Lionel
ISO/IEC JTC1/SC22/WG5 (Fortran) Convenor
Retired Intel Fortran developer/support
Email: firstname at firstnamelastname dot com
Twitter: @DoctorFortran
LinkedIn: https://www.linkedin.com/in/stevelionel
Blog: https://stevelionel.com/drfortran
WG5: https://wg5-fortran.org

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<265ae0e9-b8c6-488c-80c9-cee9a14a2438n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:622a:15c8:b0:39c:ea8a:82e3 with SMTP id d8-20020a05622a15c800b0039cea8a82e3mr34629914qty.146.1667690952512;
Sat, 05 Nov 2022 16:29:12 -0700 (PDT)
X-Received: by 2002:a05:622a:1a25:b0:3a5:719c:671b with SMTP id
f37-20020a05622a1a2500b003a5719c671bmr6514701qtb.552.1667690952342; Sat, 05
Nov 2022 16:29:12 -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: Sat, 5 Nov 2022 16:29:12 -0700 (PDT)
In-Reply-To: <jso8ptF894nU1@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:546:300:4c20:38cd:8408:b109:5906;
posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 2601:546:300:4c20:38cd:8408:b109:5906
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<jsgh44F17h5U1@mid.individual.net> <fd998593-d11b-4347-a40c-c71a2ae806d4n@googlegroups.com>
<06e26022-6faf-452c-8c34-df6e8f9a1994n@googlegroups.com> <5bc2a9c6-8eb7-40cd-8180-3892540ffb2fn@googlegroups.com>
<jso8ptF894nU1@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <265ae0e9-b8c6-488c-80c9-cee9a14a2438n@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: urbanjost@comcast.net (John)
Injection-Date: Sat, 05 Nov 2022 23:29:12 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3599
 by: John - Sat, 5 Nov 2022 23:29 UTC

On Saturday, November 5, 2022 at 7:09:53 PM UTC-4, Steve Lionel wrote:
> On 11/5/2022 4:52 PM, John wrote:
> > I just remembered an old argument about how some compilers allowed redundant parenthesis around expressions and how allowing anything but constants would break that, but just tried three compilers and none of them did so maybe that is a moot point. Does anyone know of a compiler that still allows something like "print *, (3+10*3)" printing a scalar integer, for example?
> D:\Projects>type t.f90
> print *, (3+10*3)
> end
> D:\Projects>ifort t.f90
> Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running
> on Intel(R) 64, Version 2021.7.0 Build 20220726_000000
> Copyright (C) 1985-2022 Intel Corporation. All rights reserved.
>
> Microsoft (R) Incremental Linker Version 14.33.31630.0
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> -out:t.exe
> -subsystem:console
> t.obj
>
> D:\Projects>t.exe
> 33
>
> D:\Projects>
>
> I recognize the similarity to CMPLX, but am not sure the standard wants
> to make complex constants elemental. I'm intending to write a paper and
> see what the sense of the committee is on this. For F2023, which is in
> the DIS stage, it would be simple to require the real and imaginary
> parts to be scalar. Trying to do more at this point would risk
> complications that often happen with last-minute expansions of semantics
> - and it could be considered for F202Y.
> --
> Steve Lionel
> ISO/IEC JTC1/SC22/WG5 (Fortran) Convenor
> Retired Intel Fortran developer/support
> Email: firstname at firstnamelastname dot com
> Twitter: @DoctorFortran
> LinkedIn: https://www.linkedin.com/in/stevelionel
> Blog: https://stevelionel.com/drfortran
> WG5: https://wg5-fortran.org

ifort was one of the ones I (mis)-tested. Was compiling a unicode file. So it would potentially break a lot of things to
allow for any form of expression, even a constant expression; potentially.

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<862fe5f8-0a77-4cd5-8722-83198d6bf9f9n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:620a:122a:b0:6fa:729c:2cf1 with SMTP id v10-20020a05620a122a00b006fa729c2cf1mr12508479qkj.338.1667691927424;
Sat, 05 Nov 2022 16:45:27 -0700 (PDT)
X-Received: by 2002:a05:622a:247:b0:3a5:7262:4844 with SMTP id
c7-20020a05622a024700b003a572624844mr255722qtx.77.1667691806464; Sat, 05 Nov
2022 16:43:26 -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: Sat, 5 Nov 2022 16:43:26 -0700 (PDT)
In-Reply-To: <jso8ptF894nU1@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:546:300:4c20:90fc:3c43:8a66:fa7d;
posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 2601:546:300:4c20:90fc:3c43:8a66:fa7d
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<jsgh44F17h5U1@mid.individual.net> <fd998593-d11b-4347-a40c-c71a2ae806d4n@googlegroups.com>
<06e26022-6faf-452c-8c34-df6e8f9a1994n@googlegroups.com> <5bc2a9c6-8eb7-40cd-8180-3892540ffb2fn@googlegroups.com>
<jso8ptF894nU1@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <862fe5f8-0a77-4cd5-8722-83198d6bf9f9n@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: urbanjost@comcast.net (John)
Injection-Date: Sat, 05 Nov 2022 23:45:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3555
 by: John - Sat, 5 Nov 2022 23:43 UTC

On Saturday, November 5, 2022 at 7:09:53 PM UTC-4, Steve Lionel wrote:
> On 11/5/2022 4:52 PM, John wrote:
> > I just remembered an old argument about how some compilers allowed redundant parenthesis around expressions and how allowing anything but constants would break that, but just tried three compilers and none of them did so maybe that is a moot point. Does anyone know of a compiler that still allows something like "print *, (3+10*3)" printing a scalar integer, for example?
> D:\Projects>type t.f90
> print *, (3+10*3)
> end
> D:\Projects>ifort t.f90
> Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running
> on Intel(R) 64, Version 2021.7.0 Build 20220726_000000
> Copyright (C) 1985-2022 Intel Corporation. All rights reserved.
>
> Microsoft (R) Incremental Linker Version 14.33.31630.0
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> -out:t.exe
> -subsystem:console
> t.obj
>
> D:\Projects>t.exe
> 33
>
> D:\Projects>
>
> I recognize the similarity to CMPLX, but am not sure the standard wants
> to make complex constants elemental. I'm intending to write a paper and
> see what the sense of the committee is on this. For F2023, which is in
> the DIS stage, it would be simple to require the real and imaginary
> parts to be scalar. Trying to do more at this point would risk
> complications that often happen with last-minute expansions of semantics
> - and it could be considered for F202Y.
> --
> Steve Lionel
> ISO/IEC JTC1/SC22/WG5 (Fortran) Convenor
> Retired Intel Fortran developer/support
> Email: firstname at firstnamelastname dot com program main
implicit none
print *, (3+10*3,0)
print *, (3+10*3)
print *, (3,0)
end program main

Have to say, the results with ifort and nvfortran were still surprising for the first print

33 0
33
(3.000000,0.0000000E+00)

But, as I mentioned, I quit using that syntax a long time ago.

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<jsoen0F94jvU1@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: steve@seesignature.invalid (Steve Lionel)
Newsgroups: comp.lang.fortran
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
Date: Sat, 5 Nov 2022 20:50:39 -0400
Lines: 22
Message-ID: <jsoen0F94jvU1@mid.individual.net>
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<jsgh44F17h5U1@mid.individual.net>
<fd998593-d11b-4347-a40c-c71a2ae806d4n@googlegroups.com>
<06e26022-6faf-452c-8c34-df6e8f9a1994n@googlegroups.com>
<5bc2a9c6-8eb7-40cd-8180-3892540ffb2fn@googlegroups.com>
<jso8ptF894nU1@mid.individual.net>
<862fe5f8-0a77-4cd5-8722-83198d6bf9f9n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net Pk8qhuvgKHADtQt2gFdG9ggYhELQi20hff2YLZq0XJX5rs68c7
Cancel-Lock: sha1:Vy3cTdNnVCTVNQOaVO1GpH/vNrw=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101
Thunderbird/107.0
Content-Language: en-US
In-Reply-To: <862fe5f8-0a77-4cd5-8722-83198d6bf9f9n@googlegroups.com>
 by: Steve Lionel - Sun, 6 Nov 2022 00:50 UTC

On 11/5/2022 7:43 PM, John wrote:
> implicit none
> print *, (3+10*3,0)
> print *, (3+10*3)
> print *, (3,0)
> end program main
>
> Have to say, the results with ifort and nvfortran were still surprising for the first print
>
> 33 0
Why? That's clearly a complex literal.

--
Steve Lionel
ISO/IEC JTC1/SC22/WG5 (Fortran) Convenor
Retired Intel Fortran developer/support
Email: firstname at firstnamelastname dot com
Twitter: @DoctorFortran
LinkedIn: https://www.linkedin.com/in/stevelionel
Blog: https://stevelionel.com/drfortran
WG5: https://wg5-fortran.org

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<68491149-33d0-464e-9d92-0d43f38521b5n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:7145:0:b0:39c:bdd5:30b7 with SMTP id h5-20020ac87145000000b0039cbdd530b7mr521624qtp.213.1667702776024;
Sat, 05 Nov 2022 19:46:16 -0700 (PDT)
X-Received: by 2002:ae9:e40f:0:b0:6ce:7d05:9f9e with SMTP id
q15-20020ae9e40f000000b006ce7d059f9emr515532qkc.409.1667702653918; Sat, 05
Nov 2022 19:44:13 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!border-1.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: Sat, 5 Nov 2022 19:44:13 -0700 (PDT)
In-Reply-To: <862fe5f8-0a77-4cd5-8722-83198d6bf9f9n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:fd83:933a:219f:f4b7;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:fd83:933a:219f:f4b7
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<jsgh44F17h5U1@mid.individual.net> <fd998593-d11b-4347-a40c-c71a2ae806d4n@googlegroups.com>
<06e26022-6faf-452c-8c34-df6e8f9a1994n@googlegroups.com> <5bc2a9c6-8eb7-40cd-8180-3892540ffb2fn@googlegroups.com>
<jso8ptF894nU1@mid.individual.net> <862fe5f8-0a77-4cd5-8722-83198d6bf9f9n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <68491149-33d0-464e-9d92-0d43f38521b5n@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: gah4@u.washington.edu (gah4)
Injection-Date: Sun, 06 Nov 2022 02:46:16 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 15
 by: gah4 - Sun, 6 Nov 2022 02:44 UTC

On Saturday, November 5, 2022 at 4:45:29 PM UTC-7, John wrote:

(snip)

> implicit none
> print *, (3+10*3,0)
> print *, (3+10*3)
> print *, (3,0)
> end program main

The third is a complex constant.
The second is an expression in parens.

And the form that is supposed to not be allowed, in implied-DO without the implied-DO.

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<f6b74b16-d9fb-4554-9661-97aa252a0609n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ad4:5ecd:0:b0:4b7:c95c:2c0c with SMTP id jm13-20020ad45ecd000000b004b7c95c2c0cmr38756921qvb.60.1667705275411;
Sat, 05 Nov 2022 20:27:55 -0700 (PDT)
X-Received: by 2002:a05:620a:91d:b0:6fa:442d:9a72 with SMTP id
v29-20020a05620a091d00b006fa442d9a72mr21711669qkv.487.1667705275291; Sat, 05
Nov 2022 20:27:55 -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: Sat, 5 Nov 2022 20:27:55 -0700 (PDT)
In-Reply-To: <68491149-33d0-464e-9d92-0d43f38521b5n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:546:300:4c20:9dfc:e8f8:8179:859d;
posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 2601:546:300:4c20:9dfc:e8f8:8179:859d
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<jsgh44F17h5U1@mid.individual.net> <fd998593-d11b-4347-a40c-c71a2ae806d4n@googlegroups.com>
<06e26022-6faf-452c-8c34-df6e8f9a1994n@googlegroups.com> <5bc2a9c6-8eb7-40cd-8180-3892540ffb2fn@googlegroups.com>
<jso8ptF894nU1@mid.individual.net> <862fe5f8-0a77-4cd5-8722-83198d6bf9f9n@googlegroups.com>
<68491149-33d0-464e-9d92-0d43f38521b5n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f6b74b16-d9fb-4554-9661-97aa252a0609n@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: urbanjost@comcast.net (John)
Injection-Date: Sun, 06 Nov 2022 03:27:55 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2004
 by: John - Sun, 6 Nov 2022 03:27 UTC

On Saturday, November 5, 2022 at 10:46:17 PM UTC-4, gah4 wrote:
> On Saturday, November 5, 2022 at 4:45:29 PM UTC-7, John wrote:
>
> (snip)
> > implicit none
> > print *, (3+10*3,0)
> > print *, (3+10*3)
> > print *, (3,0)
> > end program main
> The third is a complex constant.
> The second is an expression in parens.
>
> And the form that is supposed to not be allowed, in implied-DO without the implied-DO.

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<bef29c0e-dab2-4947-af5f-580c7cd1704fn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:620a:2601:b0:6bc:70bb:c56b with SMTP id z1-20020a05620a260100b006bc70bbc56bmr32064723qko.416.1667705629084;
Sat, 05 Nov 2022 20:33:49 -0700 (PDT)
X-Received: by 2002:a05:6214:29cd:b0:4bb:6b5b:a0c3 with SMTP id
gh13-20020a05621429cd00b004bb6b5ba0c3mr39549136qvb.10.1667705628858; Sat, 05
Nov 2022 20:33:48 -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: Sat, 5 Nov 2022 20:33:48 -0700 (PDT)
In-Reply-To: <jsoen0F94jvU1@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:546:300:4c20:9dfc:e8f8:8179:859d;
posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 2601:546:300:4c20:9dfc:e8f8:8179:859d
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<jsgh44F17h5U1@mid.individual.net> <fd998593-d11b-4347-a40c-c71a2ae806d4n@googlegroups.com>
<06e26022-6faf-452c-8c34-df6e8f9a1994n@googlegroups.com> <5bc2a9c6-8eb7-40cd-8180-3892540ffb2fn@googlegroups.com>
<jso8ptF894nU1@mid.individual.net> <862fe5f8-0a77-4cd5-8722-83198d6bf9f9n@googlegroups.com>
<jsoen0F94jvU1@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bef29c0e-dab2-4947-af5f-580c7cd1704fn@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: urbanjost@comcast.net (John)
Injection-Date: Sun, 06 Nov 2022 03:33:49 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2664
 by: John - Sun, 6 Nov 2022 03:33 UTC

On Saturday, November 5, 2022 at 8:50:44 PM UTC-4, Steve Lionel wrote:
> On 11/5/2022 7:43 PM, John wrote:
> > implicit none
> > print *, (3+10*3,0)
> > print *, (3+10*3)
> > print *, (3,0)
> > end program main
> >
> > Have to say, the results with ifort and nvfortran were still surprising for the first print
> >
> > 33 0
> Why? That's clearly a complex literal.
> --
> Steve Lionel
> ISO/IEC JTC1/SC22/WG5 (Fortran) Convenor
> Retired Intel Fortran developer/support
> Email: firstname at firstnamelastname dot com
> Twitter: @DoctorFortran
> LinkedIn: https://www.linkedin.com/in/stevelionel
> Blog: https://stevelionel.com/drfortran
> WG5: https://wg5-fortran.org
with list-directed output a complex value would appear at "(33.0,0.0)"; it printed as two integers. Being two (constant) expressions I actually expected an error. maybe that it would be an acceptable complex value, as it would have generated with CMPLX(); being in parenthesis I did not expect it to treat it at "print *, 3+10*3, 0".

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<579fd57d-8ce6-4c08-b1ff-16b630774a2bn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:620a:254f:b0:6cf:9b54:11dd with SMTP id s15-20020a05620a254f00b006cf9b5411ddmr30985909qko.55.1667705831799;
Sat, 05 Nov 2022 20:37:11 -0700 (PDT)
X-Received: by 2002:a05:6214:1c4a:b0:4bb:64a3:727a with SMTP id
if10-20020a0562141c4a00b004bb64a3727amr39224187qvb.16.1667705831630; Sat, 05
Nov 2022 20:37:11 -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: Sat, 5 Nov 2022 20:37:11 -0700 (PDT)
In-Reply-To: <bef29c0e-dab2-4947-af5f-580c7cd1704fn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:546:300:4c20:9dfc:e8f8:8179:859d;
posting-account=7tVJUQoAAACymEG6aShD5R0lhHCm_A0r
NNTP-Posting-Host: 2601:546:300:4c20:9dfc:e8f8:8179:859d
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<jsgh44F17h5U1@mid.individual.net> <fd998593-d11b-4347-a40c-c71a2ae806d4n@googlegroups.com>
<06e26022-6faf-452c-8c34-df6e8f9a1994n@googlegroups.com> <5bc2a9c6-8eb7-40cd-8180-3892540ffb2fn@googlegroups.com>
<jso8ptF894nU1@mid.individual.net> <862fe5f8-0a77-4cd5-8722-83198d6bf9f9n@googlegroups.com>
<jsoen0F94jvU1@mid.individual.net> <bef29c0e-dab2-4947-af5f-580c7cd1704fn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <579fd57d-8ce6-4c08-b1ff-16b630774a2bn@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: urbanjost@comcast.net (John)
Injection-Date: Sun, 06 Nov 2022 03:37:11 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2923
 by: John - Sun, 6 Nov 2022 03:37 UTC

On Saturday, November 5, 2022 at 11:33:50 PM UTC-4, John wrote:
> On Saturday, November 5, 2022 at 8:50:44 PM UTC-4, Steve Lionel wrote:
> > On 11/5/2022 7:43 PM, John wrote:
> > > implicit none
> > > print *, (3+10*3,0)
> > > print *, (3+10*3)
> > > print *, (3,0)
> > > end program main
> > >
> > > Have to say, the results with ifort and nvfortran were still surprising for the first print
> > >
> > > 33 0
> > Why? That's clearly a complex literal.
> > --
> > Steve Lionel
> > ISO/IEC JTC1/SC22/WG5 (Fortran) Convenor
> > Retired Intel Fortran developer/support
> > Email: firstname at firstnamelastname dot com
> > Twitter: @DoctorFortran
> > LinkedIn: https://www.linkedin.com/in/stevelionel
> > Blog: https://stevelionel.com/drfortran
> > WG5: https://wg5-fortran.org
> with list-directed output a complex value would appear at "(33.0,0.0)"; it printed as two integers. Being two (constant) expressions I actually expected an error. maybe that it would be an acceptable complex value, as it would have generated with CMPLX(); being in parenthesis I did not expect it to treat it at "print *, 3+10*3, 0".

or maybe it treated it as "print *,(3+10*3,0,i=1,1)"

Re: Can a named-constant in a complex-literal-constant have rank > 0?

<2030fae2-3c22-4a5a-809d-bef267ad9918n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:620a:c54:b0:6f6:3b26:1571 with SMTP id u20-20020a05620a0c5400b006f63b261571mr31742013qki.511.1667710771152;
Sat, 05 Nov 2022 21:59:31 -0700 (PDT)
X-Received: by 2002:a05:622a:170d:b0:3a5:e6b:641d with SMTP id
h13-20020a05622a170d00b003a50e6b641dmr35224507qtk.449.1667710771022; Sat, 05
Nov 2022 21:59:31 -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: Sat, 5 Nov 2022 21:59:30 -0700 (PDT)
In-Reply-To: <579fd57d-8ce6-4c08-b1ff-16b630774a2bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:78b0:8c:c553:4f71;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:78b0:8c:c553:4f71
References: <fe1b59f8-54f4-441b-bf22-315e4edab2a3n@googlegroups.com>
<jsgh44F17h5U1@mid.individual.net> <fd998593-d11b-4347-a40c-c71a2ae806d4n@googlegroups.com>
<06e26022-6faf-452c-8c34-df6e8f9a1994n@googlegroups.com> <5bc2a9c6-8eb7-40cd-8180-3892540ffb2fn@googlegroups.com>
<jso8ptF894nU1@mid.individual.net> <862fe5f8-0a77-4cd5-8722-83198d6bf9f9n@googlegroups.com>
<jsoen0F94jvU1@mid.individual.net> <bef29c0e-dab2-4947-af5f-580c7cd1704fn@googlegroups.com>
<579fd57d-8ce6-4c08-b1ff-16b630774a2bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2030fae2-3c22-4a5a-809d-bef267ad9918n@googlegroups.com>
Subject: Re: Can a named-constant in a complex-literal-constant have rank > 0?
From: gah4@u.washington.edu (gah4)
Injection-Date: Sun, 06 Nov 2022 04:59:31 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1828
 by: gah4 - Sun, 6 Nov 2022 04:59 UTC

On Saturday, November 5, 2022 at 8:37:13 PM UTC-7, John wrote:

(snip)

> or maybe it treated it as "print *,(3+10*3,0,i=1,1)"

This is my understanding.

Pages:12
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor