| 953 | } |
| 954 | |
| 955 | bool decimal_to_bfloat16(const Decimal &decimal, bfloat16_t &out) { |
| 956 | std::string text; |
| 957 | if (!decimal_plain_string(decimal, text)) { |
| 958 | return false; |
| 959 | } |
| 960 | float parsed = std::strtof(text.c_str(), nullptr); |
| 961 | out = bfloat16_t::from_float(parsed); |
| 962 | if (!bfloat16_t::is_finite(out)) { |
| 963 | return false; |
| 964 | } |
| 965 | Decimal actual; |
| 966 | return decimal_from_bfloat16(out, actual) && |
| 967 | decimal_equal_value(decimal, actual); |
| 968 | } |
| 969 | |
| 970 | bool decimal_to_float32(const Decimal &decimal, bool negative_zero, |
| 971 | float &out) { |
no test coverage detected