[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[Stds-754] Clarify decimal encoding of NaN's
I thought the definitions were in fact clear, though one may indeed have
to read between the lines. So let's see what clarifications are needed.
Issue 1: Page 21, item a) of 5.5.
The first paragraph defines what a NaN is: this is determined
entirely by bits G0-G4 and the trailing significand field T, so
that the sign bit, and bits G6-G(w+4) have nothing to do with it.
Bit G5 is mentioned separately for QNaN vs SNaN, and this could
be improved.
The second paragraph is really parenthetical, and the "therefore"
is not justified until after both DPD and BID have been defined.
(The "therefore" would be justified if DPD were the only encoding.)
So I agree that 5.5 a) is in some ways incomplete, and one has to
wait until a parenthetical remark at the end of 5.5 c) 2) the get
the full picture for BID encoding.
Issue 2: This part of the 1st paragraph of 5.5 a) is indeed misleading
with respect to BID, and strictly even for DPD. Only one other
bit of G (namely G5) distinguishes "various kinds of NaN",
namely QNaN fron SNaN. It is the trailing significand field T
that is encoded the same way as finite numbers of at most p-1
decimal digits.
The entire format description could stand some work, in that the BID
definition has not been as cleanly integrated as it might have been,
though somebody must have spent considerable time in merging the two
descriptions as much as possible. It might be clearer to give two
separate descriptions, and restore the breakdown of the (w+5)-bit
combination field G into a 5-bit combination field a w-bit exponent-
continuation field for DPD. It is of course important to note that
there is some commonality to the first four or five bits of the
combination field. I'll leave that for another day, however.
Let's first try to fix what we have here.
In any case, your proposed replacement for 5.5 a) is a substantial
normative change, because it suggests that previously unused bits
of G are now significant -- and I don't think this is what you had
in mind -- or did you? (NaNcodes with explicit exponent.)
Here is a proposed replacement, which clarifies without changing
the normative definition:
"If G0 through G4 are 11111, then v is NaN regardless of S. Furthermore,
if G5 is 1, then r is sNaN; otherwise r is qNaN. The remaining bits of
G are ignored, and the NaN payload is encoded in T in the same way as
finite numbers with at most 3J (= p-1) digits. In the case of binary
encoding, a payload exceeding 10**(3J)-1 is treated as having the value
zero.
In a canonical NaN, the ignored bits of G are zero, and the encoding
of the payload is canonical. In the case of decimal encoding, the
declets are canonical, and in the case of binary encoding, the value
does not exceed 10**(3J)-1".
Do you agree, or must I make an official amendment?
(I would also suggest, as a style review item, that Table 4 include a
column for "p", or perhaps columns for both "p" and "J".)
Michel.
Sent: 2006-08-04 16:21:05 UTC