| 1182 | } |
| 1183 | |
| 1184 | std::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 | |
| 1199 | std::string MathLib::calculate(const std::string &first, const std::string &second, char action) |
| 1200 | { |