Re: ... replacement for 14.4 and C6.2 (interchange encodings)
> Yes. And it seems to me that it is easy to extract decoration when it
> is encoded in payload. It is logical AND with a certain bit mask and
> possibly a shift.
As I pointed out, BFP NaNcodes are not portable. On some platforms you
have to reverse the bits. You also have to communicate the NaN encoding
rules, which could be messy.
> Maybe 16+0.0 16+2.0 16+4.0 16+8.0 16+12.0 is better as the decoration
> again can be extracted by a logical AND.
You just described how one extracts a floating-point integer. Indeed,
by adding 0x1p52 to the FP-encoded decoration, the FP integer becomes
a clean 32-bit unsigned integer in the bottom (least-significant) half
of a binary64 datum. This addition can be done by the sender or by
the receiver -- and letting the receiver do it preserves the standard
values of the decorations in the interchange format.
Many machines also have instructions to convert directly beween int
and double, so in C one typically simply codes deco = (int)fp_deco,
and the compiler typically generates just one or two instructions.
Michel.
---Sent: 2014-06-26 20:28:17 UTC