| 986 | } |
| 987 | |
| 988 | bool decimal_to_float64(const Decimal &decimal, bool negative_zero, |
| 989 | double &out) { |
| 990 | std::string text; |
| 991 | if (!decimal_plain_string(decimal, text)) { |
| 992 | return false; |
| 993 | } |
| 994 | out = std::strtod(text.c_str(), nullptr); |
| 995 | if (negative_zero && decimal.is_zero()) { |
| 996 | out = -0.0; |
| 997 | } |
| 998 | if (!std::isfinite(out)) { |
| 999 | return false; |
| 1000 | } |
| 1001 | Decimal actual; |
| 1002 | return decimal_from_float64(out, actual) && |
| 1003 | decimal_equal_value(decimal, actual); |
| 1004 | } |
| 1005 | |
| 1006 | bool scalar_to_bool(const ScalarValue &value, bool &out) { |
| 1007 | if (value.kind == ScalarKind::Bool) { |
no test coverage detected