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

Method mod

lib/mathlib.cpp:1184–1197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1182}
1183
1184std::string MathLib::mod(const std::string &first, const std::string &second)
1185{
1186#ifdef TEST_MATHLIB_VALUE
1187 return (value(first) % value(second)).str();
1188#else
1189 if (MathLib::isInt(first) && MathLib::isInt(second)) {
1190 const bigint b = toBigNumber(second);
1191 if (b == 0)
1192 throw InternalError(nullptr, "Internal Error: Division by zero");
1193 return MathLib::toString(toBigNumber(first) % b) + intsuffix(first, second);
1194 }
1195 return toString(std::fmod(toDoubleNumber(first),toDoubleNumber(second)));
1196#endif
1197}
1198
1199std::string MathLib::calculate(const std::string &first, const std::string &second, char action)
1200{

Callers

nothing calls this directly

Calls 4

intsuffixFunction · 0.85
valueClass · 0.70
toStringFunction · 0.70
strMethod · 0.45

Tested by

no test coverage detected