Careful, you may have to shade your eyes
[ipdf/code.git] / src / tests / arbint_vs_gmpint.cpp
1 #include <gmp.h>
2 #include <stdlib.h>
3 #include <stdio.h>
4
5 #include "log.h"
6
7 #include "gmpint.h"
8 #include "arbint.h"
9
10
11
12 using namespace IPDF;
13
14 int main(int argc, char ** argv)
15 {
16         unsigned test_cases = (argc > 1) ? atoi(argv[1]) : 100;
17         for (unsigned i = 0; i < test_cases; ++i)
18         {
19                 uint64_t a = rand();
20         
21                 Arbint arb_a(a);
22                 Gmpint gmp_a(a);
23                 
24                 uint64_t b = rand();
25                 
26                 for (unsigned j = 0; j < 5; ++j)
27                 {
28                         arb_a *= b;
29                         gmp_a *= b;
30                 }
31                 
32                 
33                 for (unsigned j = 0; j < 5; ++j)
34                 {
35                         arb_a += b;
36                         gmp_a += b;
37                 }
38                 
39                 for (unsigned j = 0; j < 5; ++j)
40                 {
41                         arb_a /= b;
42                         gmp_a /= b;
43                 }
44                 
45                 
46                 for (unsigned j = 0; j < 5; ++j)
47                 {
48                         arb_a -= b;
49                         gmp_a -= b;
50                 }               
51         }
52         return 0;
53 }

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