MCPcopy Create free account
hub / github.com/apache/fory / decimal_to_float64

Function decimal_to_float64

cpp/fory/serialization/compatible_scalar.cc:988–1004  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

986}
987
988bool 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
1006bool scalar_to_bool(const ScalarValue &value, bool &out) {
1007 if (value.kind == ScalarKind::Bool) {

Callers 1

scalar_to_float64Function · 0.85

Calls 4

decimal_plain_stringFunction · 0.85
decimal_from_float64Function · 0.85
decimal_equal_valueFunction · 0.85
is_zeroMethod · 0.45

Tested by

no test coverage detected