Doomed to failure
authorSam Moore <[email protected]>
Wed, 24 Sep 2014 11:48:20 +0000 (19:48 +0800)
committerSam Moore <[email protected]>
Wed, 24 Sep 2014 11:48:20 +0000 (19:48 +0800)
BLasdfuywetraefrdg

src/paranoidnumber.cpp
src/paranoidnumber.h
src/single [new file with mode: 0755]

index 40071e1..efae860 100644 (file)
@@ -432,14 +432,13 @@ ParanoidNumber * ParanoidNumber::OperationTerm(ParanoidNumber * b, Optype op, Pa
        #ifdef PARANOID_SIZE_LIMIT
                if (m_size >= PARANOID_SIZE_LIMIT)
                {
+                       this->operator=(this->Digit());
                        if (op == ADD)
-                       {
-                               m_value += b->Digit() / GetFactors();
-                       }
+                               m_value += b->Digit();
                        else
-                       {
-                               m_value -= b->Digit() / GetFactors();
-                       }
+                               m_value -= b->Digit();
+                       m_size = 0;
+                       Debug("Cut off %p", this);
                        return b;
                }
                //Debug("At size limit %d", m_size);
@@ -567,15 +566,14 @@ ParanoidNumber * ParanoidNumber::OperationFactor(ParanoidNumber * b, Optype op,
        #ifdef PARANOID_SIZE_LIMIT
                if (m_size >= PARANOID_SIZE_LIMIT)
                {
+                       this->operator=(this->Digit());
                        if (op == MULTIPLY)
                                m_value *= b->Digit();
                        else
                                m_value /= b->Digit();
-                               
-                       for (auto n : m_next[ADD])
-                               delete n->OperationFactor(new ParanoidNumber(*b), op);
-                       for (auto n : m_next[SUBTRACT])
-                               delete n->OperationFactor(new ParanoidNumber(*b), op);
+                       m_size = 0;
+                       
+                       Debug("Cut off %p", this);
                        return b;
                        
                }
index e57d00c..47dbdc9 100644 (file)
@@ -19,7 +19,7 @@
 //#define PARANOID_CACHE_RESULTS
 
 //#define PARANOID_USE_ARENA
-#define PARANOID_SIZE_LIMIT 0
+#define PARANOID_SIZE_LIMIT 1
 
 
 // Define to compare all ops against double ops and check within epsilon
@@ -235,6 +235,8 @@ namespace IPDF
 
                        inline void CompareForSanityEx(const char * func, const char * file, int line, const digit_t & compare, const digit_t & arg, const digit_t & eps = PARANOID_COMPARE_EPSILON)
                        {
+                               if (!SanityCheck())
+                                       Fatal("This is insane!");
                                if (fabs(Digit() - compare) > eps)
                                {
                                        Error("Called via %s(%lf) (%s:%d)", func, arg, file, line);
diff --git a/src/single b/src/single
new file mode 100755 (executable)
index 0000000..fb36604
Binary files /dev/null and b/src/single differ

UCC git Repository :: git.ucc.asn.au