MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / ExponentToPrefix

Function ExponentToPrefix

deps/google-benchmark/src/string_util.cc:89–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89std::string ExponentToPrefix(int64_t exponent, bool iec) {
90 if (exponent == 0) return "";
91
92 const int64_t index = (exponent > 0 ? exponent - 1 : -exponent - 1);
93 if (index >= kUnitsSize) return "";
94
95 const char* array =
96 (exponent > 0 ? (iec ? kBigIECUnits : kBigSIUnits) : kSmallSIUnits);
97 if (iec)
98 return array[index] + std::string("i");
99 else
100 return std::string(1, array[index]);
101}
102
103std::string ToBinaryStringFullySpecified(double value, double threshold,
104 int precision, double one_k = 1024.0) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected