X-Git-Url: https://git.llucax.com/z.facultad/75.29/dale.git/blobdiff_plain/c02e4d4bbe2b36ebaa841cea31ed3b67b165529d..dcfdf13cd3d0eea20d82057aaa280c49a9866ef5:/tests/number.cpp diff --git a/tests/number.cpp b/tests/number.cpp index 44e56ab..fc74c55 100644 --- a/tests/number.cpp +++ b/tests/number.cpp @@ -3,7 +3,7 @@ int main() { -#if 1 +#if 0 unsigned buf[5] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0 }; //unsigned buf[3] = { 0xffffffff, 0x1, 0 }; number<> nu(buf, 4); @@ -13,6 +13,7 @@ int main() std::cout << "nu2 = " << nu2 << "\n\n"; std::cout << "nu + nu2 = " << nu + nu2 << "\n\n"; std::cout << "nu * nu2 = " << nu * nu2 << "\n\n"; + std::cout << "nu^nu2 = " << potencia(nu, nu2) << "\n\n"; #endif #if 0 @@ -21,8 +22,45 @@ int main() nu << 5; std::cout << "nu = " << nu << "\n\n"; + + number<> n1 = 0x00000000; + number<> n2 = 0x00000000; + + n2 += 1; + + n1 <<= 1; + n2 <<= 1; + + if (n1 < n2) + std::cout << "n1 es menor que n2\n"; + else if (n2 < n1) + std::cout << "n1 es mayor que n2\n"; + else + std::cout << "n1 es igual que n2\n"; + + std::cout << "\n"; + + +// for (int j=0; j<10; j++) +// n1.borrow(0); + + std::cout << "n1: " << n1 ; + std::cout << "\n"; + std::cout << "n2: " << n2 ; + std::cout << "\n"; + + n1 -= n2; + + std::cout << "n1-n2: " << n1 ; #endif - return 0; + uint32_t buf[] = { 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + number<> nu(buf, 8); + number<> nu2 = 0x2; + std::cout << "nu = " << nu << "\n\n"; + std::cout << "nu2 = " << nu2 << "\n\n"; + std::cout << "nu * nu2 = " << naif(nu, nu2) << "\n\n"; + return 0; } +