[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reproducibility of minNum() and maxNum() for decimal



Here is something that we should have noticed months ago... but I
only realised this when David Hough wrote "except for minNum() ..."
in a draft of a possible revision of Clause 10.

The definition allows either operand to be returned when both are
numeric and compare equal, i.e. have the same value.

In the case of decimal, this implies that the quantum of the result
is implementation-dependent in the case of equal values but different
quanta.

This effect is observable with the sameQuantum() predicate, and this
is a problem for the "reproducible results" section, and a few other
places that mention "equal results".

There may also be an effect on signaling Invalid -- a flag that is
supposedly reproducible -- because quantize(x,y) may signal Invalid
depending on the quantum of y.

The easiest fix would be to require that minNum() and maxNum() return
the first operand in case of numerical equality, at least in decimal,
so as to avoid this unpredictability.

If that is not acceptable, several places will have to mention that
the quantum may be unpredictable:

   10.1 1st para last line:  "except for the quantum of the result
        of minNum(), maxNum(), minNumMag() and maxNumMag()."

   11, second-to-last bullet:  mention minNum() etc. as well as
          the functions of table 9.1.  (New with draft 1.7.0)

Incidentally (and this is an old issue, which I had not noticed
before), the 2nd sentence of the 1st paragraph of 10.1 should
start with "For numerical results, one rounding occurs...".
That is needed to qualify the reproducibility mentioned in the
next sentence, because strict reproducibility fails for NaNs
as well as for minNum() and friends.

Comments?  I plan to mention this in my comments on draft 1.7.0
that just entered a recirculation ballot, but I would like to hear
other's opinion on this.

Michel.
Sent: 2008-03-15 23:02:39 UTC


754 | revision | FAQ | references | list archive