41 views

Skip to first unread message

Sep 13, 2021, 11:34:43 PM9/13/21

to

I plan to open a report of this problem, but I'm having difficulty

deciding on a pithy, meaningful title. Have you any suggestions?

Feel free to point out how I've misinterpreted something and that

this isn't an actual bug. That's happened to me before. I couldn't

find anything in the documentation suggesting this limit. Does it

fail for other people? Does it fail or work on other REXXes?

If you try it, you may see that the error message on 3.9.3 is even

weirder than on older versions. Regardless of level, notice the

difference between DO I = 1 FOR N and DO I = 1 TO N.

<code>

say 'digits() =' digits()

n = 2**31 /* a 10-digit number */

say format(n,,,0) length(n) '(' || n || ')'

do i = 1 for n

say "In first loop for" n

leave i

end

numeric digits 20

say 'digits() =' digits()

n = 2**31 - 1

say format(n,,,0) length(n) '(' || n || ')'

do i = 1 for n

say "In second loop for" n

leave i

end

n = 2**31

say format(n,,,0) length(n) '(' || n || ')'

do i = 1 to n

say "In third loop TO" n

leave i

end

/*

The following yields:

Error 26.3: Value of FOR expression in DO instruction must be zero

or a positive whole number; found "2147483648"

*/

do i = 1 for n

say "In fourth loop for" n

leave i

end

exit 0

</code>

--

Arthur T. - ar23hur "at" pobox "dot" com

deciding on a pithy, meaningful title. Have you any suggestions?

Feel free to point out how I've misinterpreted something and that

this isn't an actual bug. That's happened to me before. I couldn't

find anything in the documentation suggesting this limit. Does it

fail for other people? Does it fail or work on other REXXes?

If you try it, you may see that the error message on 3.9.3 is even

weirder than on older versions. Regardless of level, notice the

difference between DO I = 1 FOR N and DO I = 1 TO N.

<code>

say 'digits() =' digits()

n = 2**31 /* a 10-digit number */

say format(n,,,0) length(n) '(' || n || ')'

do i = 1 for n

say "In first loop for" n

leave i

end

numeric digits 20

say 'digits() =' digits()

n = 2**31 - 1

say format(n,,,0) length(n) '(' || n || ')'

do i = 1 for n

say "In second loop for" n

leave i

end

n = 2**31

say format(n,,,0) length(n) '(' || n || ')'

do i = 1 to n

say "In third loop TO" n

leave i

end

/*

The following yields:

Error 26.3: Value of FOR expression in DO instruction must be zero

or a positive whole number; found "2147483648"

*/

do i = 1 for n

say "In fourth loop for" n

leave i

end

exit 0

</code>

--

Arthur T. - ar23hur "at" pobox "dot" com

Sep 14, 2021, 5:59:44 AM9/14/21

to

> I plan to open a report of this problem, but I'm having difficulty

> deciding on a pithy, meaningful title. Have you any suggestions?

27 +++ do i = 1 for n
> deciding on a pithy, meaningful title. Have you any suggestions?

line 27: Invalid whole number

Sep 14, 2021, 11:48:18 AM9/14/21

to

By default Rexx uses nine digits for a number. A whole number therefore cannot be larger than

999999999, which 2**31 is, hence the error.

Here a rexxtry.rex session (using ooRexx but this would not matter for this case):

F:\work\svn\bsf4oorexx\trunk\bsf4oorexx.dev\source_java>rexxtry

REXX-ooRexx_5.0.0(MT)_32-bit 6.05 13 Aug 2021

rexxtry.rex lets you interactively try REXX statements.

Each string is executed when you hit Enter.

Enter 'call tell' for a description of the features.

Go on - try a few... Enter 'exit' to end.

say digits()

9

........................................... rexxtry.rex on WindowsNT

say 2**32

4.2949673E+9

........................................... rexxtry.rex on WindowsNT

say 2**31

2.14748365E+9

........................................... rexxtry.rex on WindowsNT

numeric digits 10

........................................... rexxtry.rex on WindowsNT

say 2**31

2147483648

........................................... rexxtry.rex on WindowsNT

say 2**32

4294967296

........................................... rexxtry.rex on WindowsNT

As you see, once you use ten digits for a number, 2**31 and 2**32 qualify again as whole numbers.

HTH,

---rony

999999999, which 2**31 is, hence the error.

Here a rexxtry.rex session (using ooRexx but this would not matter for this case):

F:\work\svn\bsf4oorexx\trunk\bsf4oorexx.dev\source_java>rexxtry

REXX-ooRexx_5.0.0(MT)_32-bit 6.05 13 Aug 2021

rexxtry.rex lets you interactively try REXX statements.

Each string is executed when you hit Enter.

Enter 'call tell' for a description of the features.

Go on - try a few... Enter 'exit' to end.

say digits()

9

........................................... rexxtry.rex on WindowsNT

say 2**32

4.2949673E+9

........................................... rexxtry.rex on WindowsNT

say 2**31

2.14748365E+9

........................................... rexxtry.rex on WindowsNT

numeric digits 10

........................................... rexxtry.rex on WindowsNT

say 2**31

2147483648

........................................... rexxtry.rex on WindowsNT

say 2**32

4294967296

........................................... rexxtry.rex on WindowsNT

As you see, once you use ten digits for a number, 2**31 and 2**32 qualify again as whole numbers.

HTH,

---rony

Sep 15, 2021, 8:36:52 AM9/15/21

to

Rick

Sep 15, 2021, 3:59:32 PM9/15/21

to

In

Message-ID:<56dc90ab-4168-46f8...@googlegroups.com>,

I'm glad I asked here before opening a problem. And, yes, TRL2 says

that exprf (FOR operand) can be limited, but doesn't put exprt (TO

operand) in the same category. And that exactly matches the results

of my test code.

WAD even if some of us didn't realize it. I hate to think that I may

have to actually read (or at least skim through) TRL2, but this shows

why I should (have).

Message-ID:<56dc90ab-4168-46f8...@googlegroups.com>,

Rick McGuire <objec...@gmail.com> wrote:

>Even with a higher digits setting, this value is rejected for the FOR argument. This falls into the category of "numbers used directly by REXX" described on page 137 of The REXX Language, second edition. The exprf expression is one of the examples explicitly listed.

Thank you!
>Even with a higher digits setting, this value is rejected for the FOR argument. This falls into the category of "numbers used directly by REXX" described on page 137 of The REXX Language, second edition. The exprf expression is one of the examples explicitly listed.

I'm glad I asked here before opening a problem. And, yes, TRL2 says

that exprf (FOR operand) can be limited, but doesn't put exprt (TO

operand) in the same category. And that exactly matches the results

of my test code.

WAD even if some of us didn't realize it. I hate to think that I may

have to actually read (or at least skim through) TRL2, but this shows

why I should (have).

Jan 29, 2022, 12:56:55 PM1/29/22

to

On Wed, 15 Sep 2021 05:36:51 -0700 (PDT), Rick McGuire wrote:

>> > Error 26.3: Value of FOR expression in DO instruction must be zero

>> > or a positive whole number; found "2147483648"

>> > Error 26.3: Value of FOR expression in DO instruction must be zero

>> > or a positive whole number; found "2147483648"

>Even with a higher digits setting, this value is rejected for the FOR

>argument. This falls into the category of "numbers used directly by

>REXX" described on page 137 of The REXX Language, second edition. The

>exprf expression is one of the examples explicitly listed.

This seems weird when a smaller value of DIGITS() causes smaller numbers
>argument. This falls into the category of "numbers used directly by

>REXX" described on page 137 of The REXX Language, second edition. The

>exprf expression is one of the examples explicitly listed.

to be rejected, but I see it says that an implementation restriction

*may* apply, and that 9 is the *mininum* length that must be supported.

So Regina is actually supporting a little *more* than required here.

Trying it in ooRexx, I get this error starting right at 1E10.

ŹR

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu