MCPcopy Create free account
hub / github.com/couchbase/fleece / floatStr

Function floatStr

Tests/NumericTests.cc:27–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25
26template <class FLOAT>
27static string floatStr(FLOAT n) {
28 char str[32];
29 auto length = WriteFloat(n, str, sizeof(str));
30 CHECK(length == strlen(str));
31 if (sizeof(FLOAT) >= sizeof(double)) {
32 // Test for 100% accurate double->string->double round-trip:
33 CHECK(ParseDouble(str) == n);
34 }
35 return string(str);
36}
37
38
39#define expectDescription(STR, N) CHECK(floatStr(N) == STR)

Callers

nothing calls this directly

Calls 2

WriteFloatFunction · 0.85
ParseDoubleFunction · 0.85

Tested by

no test coverage detected