#53 weird minmax results for null piddles

closed-fixed
nobody
core (120)
5
2003-03-19
2002-12-27
Diab Jerius
No

minmax operations on null piddles return weird results:

perldl> $y = null

perldl> p $y->minmax
0 156
perldl> p $y->min
120
perldl> p $y->max
64

i think they should blow up.

Discussion

  • Craig DeForest

    Craig DeForest - 2003-03-19

    Logged In: YES
    user_id=20200

    The problem is that min and max were being initialized
    inside the thread loop. When there are no elements in the
    piddle, the thread loop executes zero times, leaving random
    memory contents in the return values.

    The BAD case seems to do the right thing, labeling the
    return values BAD for null piddles. The non-badvalue case
    was broken. The Right Answer is arguably NaN for
    non-badvalue perldl builds, but NaN doesn't work for integer
    values; 0 is the next best choice. (I briefly flirted with
    -1 max, +1 min, which is
    clearly invalid, but 0 seems like a less bizarre choice.)

    The code now returns 0 for null piddles.

     
  • Craig DeForest

    Craig DeForest - 2003-03-19
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks