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

RE: Two technical questions on IEEE Std 754-2008

Chuck Stevens wrote:
Have I got that right?

Yes, a large fraction of DFP bit patterns is canonical
in either BID or DPD encoding.  As I said earlier, ALL
bit patterns are in fact valid (i.e. have a defined
meaning, whether finite, infinite or NaN), so unless
you know that the data resulted from DFP *arithmetic*
(as opposed to bit-twiddling operations or perhaps raw
binary input), there is typically no way to guess the
encoding.  You'll have to study the encodings in great
detail to see if range cues could be used.  The DPD
encoding is not monotonic (when interpreting the bits
as a large binary integer); the BID encoding is almost
monotonic, so for narrow enough ranges, and a large set
of values, one may be able to get enough clues.

The one saving grace is that Infinities and NaNs can be
identified the same way in both encodings (disregarding
NaN payloads), which I gather is significant for COBOL,
based on the earlier reply to Dan Zuras.


P.S.  The problem of determining the format of data is much more
      general; it would be nice if (like Lisp) all data were tagged.
      Besides BID vs DPD there is DFP vs BFP, single vs double vs
      extended, integer vs FP, big vs little endian, and numerous
      and varied legacy formats...
---Sent: 2011-02-23 03:10:42 UTC

754 | revision | FAQ | references | list archive