Menu

#468 all versions of Regina fail to honor a new NUMERIC DIGITS when (re-)formatting a number

open
nobody
5
2017-07-07
2015-08-15
No

In the attached program, when a number is (or has to be) in exponential format (such as with NUMERIC DIGITS 4 regarding the number 1.065E+4), after setting the NUMERIC DIGITS to 9, the number is still expressed exactly the same, that is, 1.065E+4 instead of 10648.

[The only reason the NUMERIC DIGITS is that small is to make this error happen sooner for the attached program, in other words, just to save execution time and to TRACE less instructions. It also fails when using the default number of numeric digits.]

                          ________________________________________ Gerard Schildberger
1 Attachments

Discussion

  • Paul Kislanko

    Paul Kislanko - 2015-10-21

    I get:

    1st x=22 =1.065E+4 numeric digits= 4 $ =+4
    $+5= 9
    new numeric digits= 9
    2nd x=22
    =10650 numeric digits= 9

    just by changing undescore to undescore+0 on line 21.

    Rexx numbers are character strings. They will still the way they are first formed until re-evaluated under a different context. If you want the changed NUMERIC DIGITS to apply to a previously defined numeric varkiable, add zero to it. Or divide or multiply by 1.

    All versions of any correct implementation of Rexx work this way by design. It is not a bug.

     

    Last edit: Paul Kislanko 2015-10-21
  • Gerard Schildberger

    No, not all REXXes behave that way.

    R4, ROO, REXX on CMS and TSO, PC/REXX, and Personal REXX execute it
    correctly.

    (Partial output for R4 and Personal REXX:)
    2nd x=22 _=10648 numeric digits= 9

    Note that the _ (underscore) variable IS re-calculated (line 19):
    _=x**p

              __________________________________ Gerard Schildberger
    
     

Log in to post a comment.