#1179 MAX() with 256 * k Arguments Gives Error; MAX() with >=257 Arguments Gives Wrong Result

5.0.0
pending
nobody
None
none
1
2015-06-01
2013-05-28
Erich
No

Documentation for MAX() and MIN() says that "You can specify any number of numbers". The code snippet

do N=1 to 1000
  -- if N//256=0 then iterate
  interpret 'say MAX('copies('1,',N-1)'99)'
end

will test MAX() with N arguments and seems to work fine for N up to 255.

Specifying 256 arguments will result in error
"Error 40.3: Not enough arguments in invocation of MAX; minimum expected is 1"

For 257 or more arguments MAX(1,1,1,....,99) give the incorrect result "1"
Also generally, when the number of arguments is an exact multiple of 256, ooRexx will give "Error 40.3"

Discussion

  • Mark Miesfeld
    Mark Miesfeld
    2013-06-01

    Erich,

    This "bug" is due to the number of args being restricted to a maximum of 255. If you use 256 args, or a multiple of 256, it gets stored as 0 args. Which causes the Error 40.3

    When you go past 256 args, only the first 255 are seen, which in your test will all be 1 at that point. Which makes the max 1.

    This restriction is meant to be lifted. But doing so introduces an incompatibility in the stored image format when using rexxc. Not something we are going to do for a bug fix release.

    This bug will be addressed late.

     
  • Erich
    Erich
    2015-06-01

    • status: open --> pending
    • Group: None --> 5.0.0
     


Anonymous


Cancel   Add attachments