MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / str

Method str

lib/mathlib.cpp:74–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74std::string MathLib::value::str() const
75{
76 std::ostringstream ostr;
77 if (mType == MathLib::value::Type::FLOAT) {
78 if (std::isnan(mDoubleValue))
79 return "nan.0";
80 if (std::isinf(mDoubleValue))
81 return (mDoubleValue > 0) ? "inf.0" : "-inf.0";
82
83 ostr.precision(9);
84 ostr << std::fixed << mDoubleValue;
85
86 // remove trailing zeros
87 std::string ret(ostr.str());
88 std::string::size_type pos = ret.size() - 1U;
89 while (ret[pos] == '0')
90 pos--;
91 if (ret[pos] == '.')
92 ++pos;
93
94 return ret.substr(0, pos+1);
95 }
96
97 if (mIsUnsigned)
98 ostr << static_cast<biguint>(mIntValue) << "U";
99 else
100 ostr << mIntValue;
101 if (mType == MathLib::value::Type::LONG)
102 ostr << "L";
103 else if (mType == MathLib::value::Type::LONGLONG)
104 ostr << "LL";
105 return ostr.str();
106}
107
108void MathLib::value::promote(const MathLib::value &v)
109{

Callers 15

isUnchangedFunction · 0.45
hasGccCompoundStatementFunction · 0.45
checkRecursiveMethod · 0.45
fwdanalysis.cppFile · 0.45
possiblyAliasedMethod · 0.45
toStringMethod · 0.45
infoStringMethod · 0.45
isPointerDeRefMethod · 0.45
arithmeticTypeStringFunction · 0.45

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected