cbor_encode_half

Encodes a half-precision float

Since there is no native representation or semantics for half floats in the language, we use single-precision floats, as every value that can be expressed as a half-float can also be expressed as a float.

This however means that not all floats passed to this function can be unambiguously encoded. The behavior is as follows: - Infinity, NaN are preserved - Zero is preserved - Denormalized numbers keep their sign bit and 10 most significant bit of the significand - All other numbers - If the logical value of the exponent is < -24, the output is zero - If the logical value of the exponent is between -23 and -14, the output is cut off to represent the 'magnitude' of the input, by which we mean (-1)^{signbit} x 1.0e{exponent}. The value in the significand is lost. - In all other cases, the sign bit, the exponent, and 10 most significant bits of the significand are kept

@param value @param buffer Target buffer @param buffer_size Available space in the buffer @return number of bytes written

extern (C)
size_t
cbor_encode_half
(
float
,
ubyte*
,
size_t
)

Meta