7 #if POINCARE_TESTS_PRINT_EXPRESSIONS 8 #include "../src/expression_debug.h" 16 #if POINCARE_TESTS_PRINT_EXPRESSIONS 17 cout <<
"---- GCD ----" << endl;
21 Integer gcd = Arithmetic::GCD(&a, &b);
22 #if POINCARE_TESTS_PRINT_EXPRESSIONS 23 cout << gcd.approximate<
float>() << endl;
29 #if POINCARE_TESTS_PRINT_EXPRESSIONS 30 cout <<
"---- LCM ----" << endl;
34 Integer lcm = Arithmetic::LCM(&a, &b);
35 #if POINCARE_TESTS_PRINT_EXPRESSIONS 36 cout << lcm.approximate<
float>() << endl;
43 Integer outputCoefficients[100];
44 #if POINCARE_TESTS_PRINT_EXPRESSIONS 45 cout <<
"---- Primes factorization ----" << endl;
46 cout <<
"Decomp(" << a.
approximate<
float>() <<
") = ";
48 Arithmetic::PrimeFactorization(&a, outputFactors, outputCoefficients, 10);
49 #if POINCARE_TESTS_PRINT_EXPRESSIONS 52 for (
int index = 0; index < length; index++) {
53 if (outputCoefficients[index].isEqualTo(
Integer(0))) {
60 assert(outputFactors[index].approximate<float>() ==
Integer(factors[index]).approximate<float>());
61 assert(outputCoefficients[index].approximate<float>() ==
Integer(coefficients[index]).approximate<float>());
76 int factors0[5] = {2,3,5,79,1319};
77 int coefficients0[5] = {2,1,1,1,1};
79 int factors1[3] = {3,2969, 6907};
80 int coefficients1[3] = {1,1,1};
82 int factors2[3] = {2,5, 7};
83 int coefficients2[3] = {2,4,2};
85 int factors3[7] = {3,7,11, 13, 19, 3607, 3803};
86 int coefficients3[7] = {4,2,2,2,2,2,2};
void print_prime_factorization(Integer *outputFactors, Integer *outputCoefficients, int outputLength)
void assert_prime_factorization_equals_to(Integer a, int *factors, int *coefficients, int length)
QUIZ_CASE(poincare_arithmetic)
void assert_gcd_equals_to(Integer a, Integer b, Integer c)
void assert_lcm_equals_to(Integer a, Integer b, Integer c)