MCPcopy Create free account
hub / github.com/MikeMirzayanov/testlib / toHumanReadableString

Function toHumanReadableString

testlib.h:606–622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

604/* signed case. */
605template<typename T>
606static std::string toHumanReadableString(const T &n, std::false_type) {
607 if (n == 0)
608 return vtos(n);
609 int trailingZeroCount = 0;
610 T n_ = n;
611 while (n_ % 10 == 0)
612 n_ /= 10, trailingZeroCount++;
613 if (trailingZeroCount >= 7) {
614 if (n_ == 1)
615 return "10^" + vtos(trailingZeroCount);
616 else if (n_ == -1)
617 return "-10^" + vtos(trailingZeroCount);
618 else
619 return vtos(n_) + "*10^" + vtos(trailingZeroCount);
620 } else
621 return vtos(n);
622}
623
624/* unsigned case. */
625template<typename T>

Callers 3

testlib.hFile · 0.70
readUnsignedLongMethod · 0.70
readIntMethod · 0.70

Calls 1

vtosFunction · 0.70

Tested by

no test coverage detected