-
Notifications
You must be signed in to change notification settings - Fork 0
/
LN.hpp
109 lines (61 loc) · 1.8 KB
/
LN.hpp
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef LAB4_LN_HPP
#define LAB4_LN_HPP
class LN {
public:
explicit LN(long long = 0);
LN(const LN &);
LN(LN &&) noexcept;
explicit LN(std::string_view);
explicit LN(const char *);
~LN();
LN &operator=(const LN &);
LN &operator=(LN &&) noexcept;
LN operator+(const LN &) const;
LN operator-(const LN &) const;
LN operator*(const LN &) const;
LN operator/(const LN &) const;
LN operator%(const LN &) const;
LN operator~() const;
LN operator-() const;
LN &operator+=(const LN &);
LN &operator-=(const LN &);
LN &operator*=(const LN &);
LN &operator/=(LN);
LN &operator%=(LN);
LN operator<(const LN &) const;
LN operator<=(const LN &) const;
LN operator>(const LN &) const;
LN operator>=(const LN &) const;
LN operator==(const LN &) const;
LN operator!=(const LN &) const;
explicit operator long long() const;
explicit operator bool() const;
explicit operator std::string() const;
LN &changeSign();
private:
bool NaN_;
int sign_;
size_t size_;
size_t capacity_;
int *digits_;
static const long long delta_ = 20;
constexpr static int llMax_[5] = {5807, 5477, 368, 3372, 922};
constexpr static int llMin_[5] = {5808, 5477, 368, 3372, 922};
explicit LN(bool isNaN);
LN operator<<(long long) const;
LN operator>>(long long) const;
void setCapacity(size_t);
void pushBack(int);
int cmp(const LN &) const;
int absCmp(const LN &) const;
bool isZero() const;
bool isOne() const;
bool isAbsOne() const;
LN &absAdd(const LN &);
LN &absSub(const LN &);
int &at(size_t);
void removeLeadingZeros();
void error(const std::string &) const;
};
LN operator "" _ln(const char *str);
#endif //LAB4_LN_HPP