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

Two technical questions on IEEE Std 754-2008

Question 1:  the formulae and values are correct, except for one typo:

binary64:  (2**1024) - (2**981),

The "981" should have been "971".

Question 2:
Is there a simple way to determine, by examination of a datum in a decimal
interchange format without foreknowledge of the encoding used to produce it,
whether it is in the binary encoding or the decimal encoding?

No, because every bit pattern is a valid representation.  If you know that
the representation is supposed to be canonical, you may be able to tell by
detecting a non-canonical encoding under one interpretation but not the
other.  You may also be able to tell if you know the approximate value,
by decoding both ways and seeing if one is within the expected range.

If you have a large set of values all in the same encoding, there may
be some statistical tests (again based on canonicity and likely ranges).

The best way is to use a platform function to encode a known value and
to look at the resulting bits.  (This is similar to methods for detecting

---Sent: 2011-02-22 22:19:03 UTC

754 | revision | FAQ | references | list archive