Rick, with this patch applied (on both 32- and 64-bit) two failing sign()
tests uncover the following invalid behaviour:

rexx -e "do e = 1 to 25; n = '0.1e'||1~copies(e); say n~dataType~left(4) n;
end;"
NUM  0.1e1
NUM  0.1e11
NUM  0.1e111
NUM  0.1e1111
NUM  0.1e11111
NUM  0.1e111111
NUM  0.1e1111111
NUM  0.1e11111111
NUM  0.1e111111111
NUM  0.1e1111111111
NUM  0.1e11111111111
NUM  0.1e111111111111
NUM  0.1e1111111111111
NUM  0.1e11111111111111
NUM  0.1e111111111111111
NUM  0.1e1111111111111111
NUM  0.1e11111111111111111
NUM  0.1e111111111111111111
NUM  0.1e1111111111111111111
NUM  0.1e11111111111111111111
NUM  0.1e111111111111111111111
NUM  0.1e1111111111111111111111
NUM  0.1e11111111111111111111111
NUM  0.1e111111111111111111111111
NUM  0.1e1111111111111111111111111

On Wed, Jun 29, 2016 at 12:38 AM, Rick McGuire <[email protected]>
wrote:

> Having some issues with building a 32-bit version currently so I can't
> test this out, but I suspect this patch will fix this problem.
>
> Index: interpreter/classes/NumberStringClass.cpp
> ===================================================================
> --- interpreter/classes/NumberStringClass.cpp   (revision 11070)
> +++ interpreter/classes/NumberStringClass.cpp   (working copy)
> @@ -2422,9 +2422,31 @@
>          exponentSign = s == RexxString::ch_MINUS ? -1 : 1;
>      }
>
> +    /**
> +     * Add an exponent digit to this scan.  This also validates
> +     * the size of the exponent with each addition.
> +     *
> +     * @param d      The next character in the exponent.
> +     */
>      void addExponentDigit(char d)
>      {
> -        exponent = (exponent * 10) + (d - RexxString::ch_ZERO);
> +        // if the exponent is still valid, add this digit
> +        if (exponent <= Numerics::MAX_EXPONENT)
> +        {
> +            wholenumber_t new_exponent = (exponent * 10) + (d - 
> RexxString::ch_ZERO);
> +            // now we need to check for an exponent that is too large or one 
> that
> +            // caused an overflow
> +            if (new_exponent > Numerics::MAX_EXPONENT || new_exponent < 
> exponent)
> +            {
> +                // set this to an invalid exponent so we can flag this as 
> invalid later
> +                exponent = Numerics::MAX_EXPONENT + 1;
> +            }
> +            else
> +            {
> +                // this is a good value (so far)
> +                exponent = new_exponent;
> +            }
> +        }
>      }
>
>      bool finish()
>
>
> On Tue, Jun 28, 2016 at 3:07 PM, Erich Steinböck <
> [email protected]> wrote:
>
>> I have a suspicion this test in NumberString::checkIntengerDigits is
>>> wrong.
>>>
>> Yes, that was exactly what was needed!!!
>> Thanks, saved me a *lot* of time to investigate.
>>
>>
>> Now, there's a strange last one, again 32-bit-only, issue left:
>>
>> rexx -e "do e = 1 to 25; n = '123e'||1~copies(e); say n~dataType~left(4)
>> n; end;"
>> NUM  123e1
>> NUM  123e11
>> NUM  123e111
>> NUM  123e1111
>> NUM  123e11111
>> NUM  123e111111
>> NUM  123e1111111
>> NUM  123e11111111
>> NUM  123e111111111
>> CHAR 123e1111111111
>> CHAR 123e11111111111
>> NUM  123e111111111111
>> CHAR 123e1111111111111
>> NUM  123e11111111111111
>> NUM  123e111111111111111
>> CHAR 123e1111111111111111
>> NUM  123e11111111111111111
>> CHAR 123e111111111111111111
>> NUM  123e1111111111111111111
>> CHAR 123e11111111111111111111
>> NUM  123e111111111111111111111
>> NUM  123e1111111111111111111111
>> CHAR 123e11111111111111111111111
>> CHAR 123e111111111111111111111111
>> CHAR 123e1111111111111111111111111
>>
>>
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to