--- libecb/ecb.pod 2015/02/20 11:28:08 1.66 +++ libecb/ecb.pod 2015/11/21 18:09:37 1.72 @@ -244,7 +244,7 @@ =item ecb_deprecated_message (message) -Same as C, but if possible, supplies a diagnostic that is +Same as C, but if possible, the specified diagnostic is used instead of a generic depreciation message when the object is being used. @@ -688,26 +688,29 @@ =over 4 -=item ECB_INFINITY +=item ECB_INFINITY [-UECB_NO_LIBM] Evaluates to positive infinity if supported by the platform, otherwise to a truly huge number. -=item ECB_NAN +=item ECB_NAN [-UECB_NO_LIBM] Evaluates to a quiet NAN if supported by the platform, otherwise to C. -=item float ecb_ldexpf (float x, int exp) +=item float ecb_ldexpf (float x, int exp) [-UECB_NO_LIBM] Same as C, but always available. +=item uint32_t ecb_float_to_binary16 (float x) [-UECB_NO_LIBM] + =item uint32_t ecb_float_to_binary32 (float x) [-UECB_NO_LIBM] =item uint64_t ecb_double_to_binary64 (double x) [-UECB_NO_LIBM] These functions each take an argument in the native C or C -type and return the IEEE 754 bit representation of it. +type and return the IEEE 754 bit representation of it (binary16/half, +binary32/single or binary64/double precision). The bit representation is just as IEEE 754 defines it, i.e. the sign bit will be the most significant bit, followed by exponent and mantissa. @@ -721,7 +724,7 @@ be able to optimise away this function completely. These functions can be helpful when serialising floats to the network - you -can serialise the return value like a normal uint32_t/uint64_t. +can serialise the return value like a normal uint16_t/uint32_t/uint64_t. Another use for these functions is to manipulate floating point values directly. @@ -738,11 +741,12 @@ =item float ecb_binary32_to_float (uint32_t x) [-UECB_NO_LIBM] -=item double ecb_binary32_to_double (uint64_t x) [-UECB_NO_LIBM] +=item double ecb_binary64_to_double (uint64_t x) [-UECB_NO_LIBM] The reverse operation of the previous function - takes the bit -representation of an IEEE binary16, binary32 or binary64 number and -converts it to the native C or C format. +representation of an IEEE binary16, binary32 or binary64 number (half, +single or double precision) and converts it to the native C or +C format. This function should work even when the native floating point format isn't IEEE compliant, of course at a speed and code size penalty, and of course @@ -753,6 +757,19 @@ On all modern platforms (where C is true), the compiler should be able to optimise away this function completely. +=item uint16_t ecb_binary32_to_binary16 (uint32_t x) + +=item uint32_t ecb_binary16_to_binary32 (uint16_t x) + +Convert a IEEE binary32/single precision to binary16/half format, and vice +versa, handling all details (round-to-nearest-even, subnormals, infinity +and NaNs) correctly. + +These are functions are available under C<-DECB_NO_LIBM>, since +they do not rely on the platform floating point format. The +C and C functions are +usually what you want. + =back =head2 ARITHMETIC @@ -842,4 +859,23 @@ =back +=head1 UNDOCUMENTED FUNCTIONALITY + +F is full of undocumented functionality as well, some of which is +intended to be internal-use only, some of which we forgot to document, and +some of which we hide because we are not sure we will keep the interface +stable. + +While you are welcome to rummage around and use whatever you find useful +(we can't stop you), keep in mind that we will change undocumented +functionality in incompatible ways without thinking twice, while we are +considerably more conservative with documented things. + +=head1 AUTHORS + +C is designed and maintained by: + + Emanuele Giaquinta + Marc Alexander Lehmann +