Summary: Title. Note that this is a no-op with default parameters because folly::toAppend(double, &dest) calls folly::toAppend(double, &dest, DtoaMode, numDigits) with DtoaMode = SHORTEST and numDigits = 0.
Test Plan: Tested new functionality in
D1212547.
Reviewed By: kelarini@fb.com
FB internal diff:
D1212617
throw std::runtime_error("folly::toJson: JSON object value was a "
"NaN or INF");
}
- toAppend(v.asDouble(), &out_);
+ toAppend(v.asDouble(), &out_, opts_.double_mode, opts_.double_num_digits);
break;
case dynamic::INT64: {
auto intval = v.asInt();
, sort_keys(false)
, skip_invalid_utf8(false)
, allow_nan_inf(false)
+ , double_mode(double_conversion::DoubleToStringConverter::SHORTEST)
+ , double_num_digits(0) // ignored when mode is SHORTEST
{}
// If true, keys in an object can be non-strings. (In strict
// true to allow NaN or INF values
bool allow_nan_inf;
+
+ // Options for how to print floating point values. See Conv.h
+ // toAppend implementation for floating point for more info
+ double_conversion::DoubleToStringConverter::DtoaMode double_mode;
+ unsigned int double_num_digits;
};
/*