+ return !fetestexcept(FE_ALL_EXCEPT);
+}
+
+
+template <>
+bool TrustingOp<int8_t>(int8_t & a, const int8_t & b, Optype op)
+{
+ int16_t sa(a);
+ bool exact = true;
+ switch (op)
+ {
+ case ADD:
+ sa += b;
+ exact = (abs(sa) <= 127);
+ break;
+ case SUBTRACT:
+ sa -= b;
+ exact = (abs(sa) <= 127);
+ break;
+ case MULTIPLY:
+ sa *= b;
+ exact = (abs(sa) <= 127);
+ break;
+ case DIVIDE:
+ exact = (b != 0 && sa > b && sa % b == 0);
+ sa /= b;
+ break;
+ case NOP:
+ break;
+ }
+ a = (int8_t)(sa);
+ return exact;
+}
+
+
+ParanoidNumber & ParanoidNumber::operator+=(const digit_t & a)
+{
+ #ifdef PARANOID_COMPARE_EPSILON
+ digit_t compare = Digit();
+ compare += a;
+ #endif
+ delete Operation(new ParanoidNumber(a), ADD);
+ Simplify(SUBTRACT);
+ Simplify(ADD);
+ #ifdef PARANOID_COMPARE_EPSILON
+ CompareForSanity(compare, a);
+ #endif
+ return *this;
+}
+
+
+ParanoidNumber & ParanoidNumber::operator-=(const digit_t & a)
+{
+ #ifdef PARANOID_COMPARE_EPSILON
+ digit_t compare = Digit();
+ compare -= a;
+ #endif
+ delete Operation(new ParanoidNumber(a), SUBTRACT);
+ Simplify(ADD);
+ Simplify(SUBTRACT);
+ #ifdef PARANOID_COMPARE_EPSILON
+ CompareForSanity(compare, a);
+ #endif
+ return *this;
+}
+
+ParanoidNumber & ParanoidNumber::operator*=(const digit_t & a)
+{
+ #ifdef PARANOID_COMPARE_EPSILON
+ digit_t compare = Digit();
+ compare *= a;
+ #endif
+ delete Operation(new ParanoidNumber(a), MULTIPLY);
+ Simplify(DIVIDE);
+ Simplify(MULTIPLY);
+ #ifdef PARANOID_COMPARE_EPSILON
+ CompareForSanity(compare, a);
+ #endif
+ return *this;
+}
+
+
+ParanoidNumber & ParanoidNumber::operator/=(const digit_t & a)
+{
+ #ifdef PARANOID_COMPARE_EPSILON
+ digit_t compare = Digit();
+ compare /= a;
+ #endif
+ delete Operation(new ParanoidNumber(a), DIVIDE);
+ Simplify(MULTIPLY);
+ Simplify(DIVIDE);
+ #ifdef PARANOID_COMPARE_EPSILON
+ CompareForSanity(compare, a);
+ #endif
+ return *this;
+}
+
+
+ParanoidNumber & ParanoidNumber::operator+=(const ParanoidNumber & a)
+{
+ #ifdef PARANOID_COMPARE_EPSILON
+ digit_t compare = Digit();
+ compare += a.Digit();
+ #endif
+ delete Operation(new ParanoidNumber(a), ADD);
+ Simplify(SUBTRACT);
+ Simplify(ADD);
+ #ifdef PARANOID_COMPARE_EPSILON
+ CompareForSanity(compare, a.Digit());
+ #endif
+ return *this;
+}
+
+
+ParanoidNumber & ParanoidNumber::operator-=(const ParanoidNumber & a)
+{
+ #ifdef PARANOID_COMPARE_EPSILON
+ digit_t compare = Digit();
+ compare -= a.Digit();
+ #endif
+ delete Operation(new ParanoidNumber(a), SUBTRACT);
+ Simplify(ADD);
+ Simplify(SUBTRACT);
+ #ifdef PARANOID_COMPARE_EPSILON
+ CompareForSanity(compare, a.Digit());
+ #endif