-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBigInteger.h
More file actions
executable file
·93 lines (53 loc) · 2.26 KB
/
BigInteger.h
File metadata and controls
executable file
·93 lines (53 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#pragma once
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <iomanip>
template<typename T, size_t Base>
class BigInteger;
template<typename T, size_t Base>
std::ostream &operator<<(std::ostream &, BigInteger<T, Base> &);
template<typename T, size_t Base>
std::ostream &operator<<(std::ostream &, BigInteger<T, Base> &);
template<typename T, size_t Base = std::numeric_limits<T>::max()>
class BigInteger {
friend std::ostream &operator<<<>(std::ostream &, BigInteger &);
friend std::ostream &operator<<<>(std::ostream &, BigInteger &);
public:
T operator[](size_t id) const;
template<typename T1, size_t NewBase>
explicit operator BigInteger<T1, NewBase>();
void cutBadZero();
std::pair<T, bool> add_with_overflow(const T &first, const T &second) const;
std::pair<T, T> mul_with_overflow(const T &first, const T &second) const;
std::pair<T, T> div_with_overflow(std::pair<T, T> pair, const T &third) const;
short compare(BigInteger<T, Base> &other);
BigInteger<T, Base> multiply(const BigInteger<T, Base> &first ,const BigInteger<T, Base> &second);
T div_long_short(T number);
void mul_long_short(T number);
void add_long_short(T number);
int sign;
BigInteger();
explicit BigInteger(long long x);
std::vector<T> digits;
//explicit BigInteger(long long value = 0);
BigInteger(const BigInteger &);
BigInteger &operator=(const BigInteger &) = default;
BigInteger(BigInteger &&);
BigInteger &operator+=(const BigInteger &);
BigInteger &operator*=(const BigInteger &);
BigInteger operator+(const BigInteger &) const;
BigInteger operator*(const BigInteger &) const;
BigInteger &operator-=(const BigInteger &);
BigInteger operator-(const BigInteger &) const;
bool operator>(const BigInteger &);
bool operator==(const BigInteger &);
bool operator>=(const BigInteger &);
bool operator<(const BigInteger &);
bool operator!=(const BigInteger &);
bool operator<=(const BigInteger &);
size_t Size() const;
bool pair_compair(const std::pair<T, T> &first, const std::pair<T, T> &second) const;
};