+bool ParanoidNumber::FullSimplify()
+{
+ bool result = false;
+ result |= Simplify(MULTIPLY);
+ result |= Simplify(DIVIDE);
+ result |= Simplify(ADD);
+ result |= Simplify(SUBTRACT);
+ return result;
+}
+
+
+ParanoidNumber::digit_t ParanoidNumber::Digit()
+{
+ if (!isnan(m_cached_result))
+ return m_cached_result;
+ m_cached_result = m_value;
+ for (auto mul : m_next[MULTIPLY])
+ {
+ m_cached_result *= mul->Digit();
+ }
+ for (auto div : m_next[DIVIDE])
+ {
+ m_cached_result /= div->Digit();
+ }
+ for (auto add : m_next[ADD])
+ m_cached_result += add->Digit();
+ for (auto sub : m_next[SUBTRACT])
+ m_cached_result -= sub->Digit();
+ return m_cached_result;
+
+}
+
+ParanoidNumber::digit_t ParanoidNumber::GetFactors()
+{
+ digit_t value = 1;
+ for (auto mul : m_next[MULTIPLY])
+ value *= mul->Digit();
+ for (auto div : m_next[DIVIDE])
+ value /= div->Digit();
+ return value;
+}
+