… | |
… | |
693 | #define ECB_NAN ECB_INFINITY |
693 | #define ECB_NAN ECB_INFINITY |
694 | #endif |
694 | #endif |
695 | |
695 | |
696 | #if ECB_C99 || _XOPEN_VERSION >= 600 || _POSIX_VERSION >= 200112L |
696 | #if ECB_C99 || _XOPEN_VERSION >= 600 || _POSIX_VERSION >= 200112L |
697 | #define ecb_ldexpf(x,e) ldexpf ((x), (e)) |
697 | #define ecb_ldexpf(x,e) ldexpf ((x), (e)) |
|
|
698 | #define ecb_frexpf(x,e) frexpf ((x), (e)) |
698 | #else |
699 | #else |
699 | #define ecb_ldexpf(x,e) (float) ldexp ((double) (x), (e)) |
700 | #define ecb_ldexpf(x,e) (float) ldexp ((double) (x), (e)) |
|
|
701 | #define ecb_frexpf(x,e) (float) frexp ((double) (x), (e)) |
700 | #endif |
702 | #endif |
701 | |
703 | |
702 | /* converts an ieee half/binary16 to a float */ |
704 | /* converts an ieee half/binary16 to a float */ |
703 | ecb_function_ ecb_const float ecb_binary16_to_float (uint16_t x); |
705 | ecb_function_ ecb_const float ecb_binary16_to_float (uint16_t x); |
704 | ecb_function_ ecb_const float |
706 | ecb_function_ ecb_const float |
… | |
… | |
733 | if (x == 0e0f ) return 0x00000000U; |
735 | if (x == 0e0f ) return 0x00000000U; |
734 | if (x > +3.40282346638528860e+38f) return 0x7f800000U; |
736 | if (x > +3.40282346638528860e+38f) return 0x7f800000U; |
735 | if (x < -3.40282346638528860e+38f) return 0xff800000U; |
737 | if (x < -3.40282346638528860e+38f) return 0xff800000U; |
736 | if (x != x ) return 0x7fbfffffU; |
738 | if (x != x ) return 0x7fbfffffU; |
737 | |
739 | |
738 | m = frexpf (x, &e) * 0x1000000U; |
740 | m = ecb_frexpf (x, &e) * 0x1000000U; |
739 | |
741 | |
740 | r = m & 0x80000000U; |
742 | r = m & 0x80000000U; |
741 | |
743 | |
742 | if (r) |
744 | if (r) |
743 | m = -m; |
745 | m = -m; |