| 938 | } |
| 939 | |
| 940 | bool decimal_to_float16(const Decimal &decimal, float16_t &out) { |
| 941 | std::string text; |
| 942 | if (!decimal_plain_string(decimal, text)) { |
| 943 | return false; |
| 944 | } |
| 945 | float parsed = std::strtof(text.c_str(), nullptr); |
| 946 | out = float16_t::from_float(parsed); |
| 947 | if (!float16_t::is_finite(out)) { |
| 948 | return false; |
| 949 | } |
| 950 | Decimal actual; |
| 951 | return decimal_from_float16(out, actual) && |
| 952 | decimal_equal_value(decimal, actual); |
| 953 | } |
| 954 | |
| 955 | bool decimal_to_bfloat16(const Decimal &decimal, bfloat16_t &out) { |
| 956 | std::string text; |
no test coverage detected