What triggers line 373 in Rexx.nrx

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

What triggers line 373 in Rexx.nrx

Jason Martin
    367          /* Found 'e' or 'E' -- now process exponent */
    368          if i>len-3 then return            -- no room for sign +
one digit
    369          if len-i>11 then return           -- more than sign + 9
digits
    370          if s[i+1]='-'       then eneg=boolean 1
    371           else if s[i+1]='+' then eneg=0
    372           else return -- not a number unless sign after the 'E'
    373          if len-i-2>9 then return


if len-i-2>9 then return

A number like 1E+999999999 is the closest I can get which is equal to 9.

Is it:

1) EBCDIC?

2) Escape sequences?

3) right to left languages?

4) All unicode?

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: What triggers line 373 in Rexx.nrx

rvjansen
Hi Jason,

it’s not that I did not see this - just could not find the time to look into it. Maybe Mike can answer this from the top of his head?

René.

> On 30 Jun 2020, at 01:36, Jason Martin <[hidden email]> wrote:
>
>    367          /* Found 'e' or 'E' -- now process exponent */
>    368          if i>len-3 then return            -- no room for sign + one digit
>    369          if len-i>11 then return           -- more than sign + 9 digits
>    370          if s[i+1]='-'       then eneg=boolean 1
>    371           else if s[i+1]='+' then eneg=0
>    372           else return -- not a number unless sign after the 'E'
>    373          if len-i-2>9 then return
>
>
> if len-i-2>9 then return
>
> A number like 1E+999999999 is the closest I can get which is equal to 9.
>
> Is it:
>
> 1) EBCDIC?
>
> 2) Escape sequences?
>
> 3) right to left languages?
>
> 4) All unicode?
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : https://urldefense.proofpoint.com/v2/url?u=http-3A__ibm-2Dnetrexx.215625.n3.nabble.com_&d=DwIFaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_6rXNpPJ1fYV-3bV1za02NiR4PUelvicfHXwtnTXpXE&m=U46HXG-fGILjijxWkFVjCJZjBlAM_muMMoX3fFzIr8w&s=EpboY7ECYzeTuJq3vsYLyVc2Ba6CU4GkYluTucK3P2U&e= 
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: What triggers line 373 in Rexx.nrx

Dave Woodman
I'm probably being really dumb, but...

Line 369 is

        If len -i > 11 then return

Line 373 is

        If len -i -2 > 9 then return

Adding two to each side makes this

        If len -i > 11 then return

Which seems a little familiar...

If I have not been stupid, I would say that nothing triggers that line.

-----Original Message-----
From: [hidden email] <[hidden email]> On Behalf Of René Jansen
Sent: 02 July 2020 09:56
To: IBM Netrexx <[hidden email]>
Subject: Re: [Ibm-netrexx] What triggers line 373 in Rexx.nrx

Hi Jason,

it’s not that I did not see this - just could not find the time to look into it. Maybe Mike can answer this from the top of his head?

René.

> On 30 Jun 2020, at 01:36, Jason Martin <[hidden email]> wrote:
>
>    367          /* Found 'e' or 'E' -- now process exponent */
>    368          if i>len-3 then return            -- no room for sign + one digit
>    369          if len-i>11 then return           -- more than sign + 9 digits
>    370          if s[i+1]='-'       then eneg=boolean 1
>    371           else if s[i+1]='+' then eneg=0
>    372           else return -- not a number unless sign after the 'E'
>    373          if len-i-2>9 then return
>
>
> if len-i-2>9 then return
>
> A number like 1E+999999999 is the closest I can get which is equal to 9.
>
> Is it:
>
> 1) EBCDIC?
>
> 2) Escape sequences?
>
> 3) right to left languages?
>
> 4) All unicode?
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : https://urldefense.proofpoint.com/v2/url?u=http-3A__ibm-2Dnetrexx.215625.n3.nabble.com_&d=DwIFaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_6rXNpPJ1fYV-3bV1za02NiR4PUelvicfHXwtnTXpXE&m=U46HXG-fGILjijxWkFVjCJZjBlAM_muMMoX3fFzIr8w&s=EpboY7ECYzeTuJq3vsYLyVc2Ba6CU4GkYluTucK3P2U&e= 
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : https://urldefense.proofpoint.com/v2/url?u=http-3A__ibm-2Dnetrexx.215625.n3.nabble.com_&d=DwIFaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_6rXNpPJ1fYV-3bV1za02NiR4PUelvicfHXwtnTXpXE&m=wqmnGOzAe0HjCmYE33z_VJAXkmH_4i4yx_Gr67Yh_ps&s=S9pm_4sttUPMPXNIl6EKMBmR4P59tD8FzPw-XP_9uew&e= 


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: What triggers line 373 in Rexx.nrx

Jason Martin
I do not believe anything triggers it either but

I am not familiar with Java and EBCDIC.

I have run 40,000 to 50,000 number values through it

plus 40 years worth of parsed text from Mother Earth magazine

and The Gutenberg Webster's Unabridged Dictionary by Project Gutenberg

although all of this is the English language only.

On 2020-07-02 05:35, Dave Woodman wrote:
> If I have not been stupid, I would say that nothing triggers that line.
_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: What triggers line 373 in Rexx.nrx

Mike Cowlishaw
In reply to this post by Jason Martin
 
From a quick look, the test is redundant given the earlier test for len-i>11
at line 369.  At a guess line 373 was the original code and I then added 369
to avoid the 370-372 tests for this case.  I then probably left the 373 test
in the code so that it was obvious that the case was being tested for and to
make it easier to change later if need be.  (Also I think that originally
the '+' sign was not required -- so this code has 'evolved'.)

Nowadays I'd write the 9 using some pre-defined named constant, and the
eleven as that constant plus constants for the length of the E and sign,
dependent on whether the sign was required or not.  But 25 years ago every
test was expensive, especially in something so frequently used as arithmetic
...

Mike

 

>     367          /* Found 'e' or 'E' -- now process exponent */
>     368          if i>len-3 then return            -- no room
> for sign + one digit
>     369          if len-i>11 then return           -- more
> than sign + 9 digits
>     370          if s[i+1]='-'       then eneg=boolean 1
>     371           else if s[i+1]='+' then eneg=0
>     372           else return -- not a number unless sign
> after the 'E'
>     373          if len-i-2>9 then return
>
>
> if len-i-2>9 then return
>
> A number like 1E+999999999 is the closest I can get which is
> equal to 9.
>
> Is it:
>
> 1) EBCDIC?
>
> 2) Escape sequences?
>
> 3) right to left languages?
>
> 4) All unicode?
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : https://urldefense.proofpoint.com/v2/url?u=http-3A__ibm-2Dnetrexx.215625.n3.nabble.com_&d=DwIFAw&c=jf_iaSHvJObTbx-siA1ZOg&r=_6rXNpPJ1fYV-3bV1za02NiR4PUelvicfHXwtnTXpXE&m=V3B1DSakmRx5Q4-n8O6dPtEieO4uHCPjVInz3dUmgQM&s=d17NvWZVC3eTZShLDD3b-jUdvU7XpPIRrsN-q2WW0aA&e= 
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: What triggers line 373 in Rexx.nrx

Jason Martin
In reply to this post by Jason Martin
Let's at least note that in a comment in the code.

Thank all of you.

Jason

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: What triggers line 373 in Rexx.nrx

Mike Cowlishaw
I'd be inclined to just delete the line 369.   That's a rare case anyway,
and the later test is clearer.

Mike

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Jason Martin
> Sent: 02 July 2020 17:06
> To: IBM Netrexx
> Subject: Re: [Ibm-netrexx] What triggers line 373 in Rexx.nrx
>
> Let's at least note that in a comment in the code.
>
> Thank all of you.
>
> Jason
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : https://urldefense.proofpoint.com/v2/url?u=http-3A__ibm-2Dnetrexx.215625.n3.nabble.com_&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=_6rXNpPJ1fYV-3bV1za02NiR4PUelvicfHXwtnTXpXE&m=YK3dvYQ7FzwS2KQpedfC7j8icCdWSwdXFOSFIgYAurA&s=cds77APHbJwlh8jxGTryrbxSgawJc16h7fBkeBGPyfY&e= 
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: What triggers line 373 in Rexx.nrx

Jason Martin
In reply to this post by Jason Martin
I will leave that to René or others.

Not having a good day, mind not clear.

I have some more questions like this one but have not got that far yet.

Thank you again for hanging around the forum.

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/