35 const double diff = (x > y) ? x - y : y - x;
36 return !((diff / 2) < diff);
40 return isEqual(
double(x),
double(y));
49 template<
class R,
class T>
50 R
calculate(
const std::string& s,
const T& x,
const T& y,
bool* error =
nullptr)
66 if (
isZero(y) || (std::is_integral<T>{} && std::is_signed<T>{} &&
isEqual(y, T(-1)) &&
isEqual(x, std::numeric_limits<T>::min()))) {
90 if (y >= maxBitsSignedShift || y < 0 || x < 0) {
97 if (y >= maxBitsSignedShift || y < 0 || x < 0) {
122 T
calculate(
const std::string& s,
const T& x,
const T& y,
bool* error =
nullptr)
124 return calculate<T, T>(s, x, y,
error);
R calculate(const std::string &s, const T &x, const T &y, bool *error=nullptr)
static unsigned int encodeMultiChar(const std::string &str)
@ error
Programming error.
Simple container to be thrown when internal error is detected.