2 #include "../src/number.h"
7 unsigned bufA[] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff };
8 unsigned bufB[] = { 0xffffffff, 0x00000000, 0x00000000, 0x00000000 };
9 //unsigned buf[3] = { 0xffffffff, 0x1, 0 };
10 //number< unsigned > nu2(nu);
11 //number<> B = 0xffffffffU;
12 number<> A(bufA, 4, positive);
13 number<> B(bufB, 4, positive);
16 std::cout << "nu = " << A << "\n\n";
17 std::cout << "nu2 = " << B << "\n\n";
18 std::cout << "nu + nu2 = " << A + B << "\n\n";
20 number<> N = naif(A, B);
21 std::cout << "nu `naif` nu2 = " << N << "\n\n";
23 number<> K = karatsuba(A, B);
24 std::cout << "nu `ko` nu2 = " << K << "\n\n";
28 number<> N2 = naif(A, A);
29 std::cout << "nu `naif` nu = " << N2 << "\n\n";
31 number<> K2 = karatsuba(A, A);
32 std::cout << "nu `ko` nu = " << K2 << "\n\n";
36 //std::cout << "nu^nu2 = " << pot_dyc_n(A, B) << "\n\n";
40 std::cout << "r = " << naif(X, Y) << "\n\n";
43 number <>rd = pot_dyc_n(X, Y);
44 std::cout << "x `pot_dyc_n` y = " << rd << "\n\n";
45 number <>rc = pot_dyc_k(X, Y);
46 std::cout << "x `pot_dyc_k` y = " << rc << "\n\n";
48 printf("Las pot NO DAN\n");
50 printf("Las pot dan iguales\n");
54 unsigned buf1[] = { 0xffffffff, 0xffffffff };
55 number<> T(buf1, 2, positive);
56 normalize_length(T, T);
57 std::cout << "test: " << naif(T, T) << "\n\n";
61 number< unsigned > nu = 0xffffffff;
62 std::cout << "nu = " << nu ;
65 std::cout << "nu = " << nu ;
67 number<> n1 = 0xffff00f1;
68 number<> n2 = 0xffff00f0;
70 normalize_length(n1, n2);
77 /* for (int k = 0; k < 100; k++)
79 n1 += (unsigned) rand() * k;
80 n2 += (unsigned) rand() * k;
88 std::cout << "n1 es menor que n2\n";
90 std::cout << "n1 es mayor que n2\n";
92 std::cout << "n1 es igual que n2\n";
97 // for (int j=0; j<10; j++)
100 std::cout << "n1: " << n1 ;
102 std::cout << "n2: " << n2 ;
107 std::cout << "n1-n2: " << n1 << "\n";
111 uint32_t buf[] = { 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
112 number<> nu(buf, 8, negative);
114 std::cout << "nu = " << nu ;
116 std::cout << "nu2 = " << nu2 ;
118 std::cout << "nu * nu2 = " << naif(nu, nu2) ;
120 std::cout << "nu + nu2 = " << nu + nu2 ;
122 std::cout << "nu - nu2 = " << nu - nu2 ;
126 number<> h = 0x10000000;
134 number<> m = 0xfffffffe;
140 std::cout << "h: " << h ;
142 std::cout << "d: " << d ;
144 std::cout << "m: " << m ;
147 number<> a = h - d - m;
149 std::cout << "h-d-m: " << a << "\n";