MCPcopy Create free account
hub / github.com/apache/thrift / doubleToString

Function doubleToString

lib/cpp/src/thrift/protocol/TJSONProtocol.cpp:527–534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

525
526namespace {
527std::string doubleToString(double d) {
528 std::ostringstream str;
529 str.imbue(std::locale::classic());
530 const std::streamsize max_digits10 = 2 + std::numeric_limits<double>::digits10;
531 str.precision(max_digits10);
532 str << d;
533 return str.str();
534}
535}
536
537// Convert the given double to a JSON string, which is either the number,

Callers 1

writeJSONDoubleMethod · 0.85

Calls 1

strMethod · 0.80

Tested by

no test coverage detected