+ }
+}
+
+void TestConstructFromDouble(unsigned cases)
+{
+ for (unsigned c = 0; c < cases; ++c)
+ {
+ int64_t test = (int64_t)(rand()*1e6);
+ double d = (double)(test);
+ Arbint a(d);
+ Arbint b(test);
+ if (a != b)
+ {
+ Fatal("test is %li, d is %f, a is %s, b is %s", test, d, a.DigitStr().c_str(), b.DigitStr().c_str());
+ }
+
+
+ }
+}
+
+void TestSubtraction()
+{
+ Arbint b(2u, 45L, 10L);
+ Arbint a(1u, 128L, 0L);
+ Arbint c(a - b);
+ Arbint test = -Arbint(2u, 18446744073709551533LU,9L);
+ Debug("%c%s - %c%s = %c%s", a.SignChar(), a.DigitStr().c_str(), b.SignChar(), b.DigitStr().c_str(), c.SignChar(), c.DigitStr().c_str());
+ if (c != test)
+ {
+ Fatal("Expected %c%s, got %c%s", test.SignChar(), test.DigitStr().c_str(), c.SignChar(), c.DigitStr().c_str());