11 if (num.type ==
INT) {
12 return out << num.value.
i;
13 }
else if (num.type ==
FLOAT) {
14 return out << fixed << num.value.
f;
21 if (lhs.type ==
INT && rhs.type ==
INT) {
22 return lhs.value.
i == rhs.value.
i;
23 }
else if (lhs.type ==
FLOAT && rhs.type ==
FLOAT) {
24 return lhs.value.
f == rhs.value.
f;
25 }
else if (lhs.type ==
INT && rhs.type ==
FLOAT) {
26 return lhs.value.
i == rhs.value.
f;
27 }
else if (lhs.type ==
FLOAT && rhs.type ==
INT) {
28 return lhs.value.
f == rhs.value.
i;
39 if (lhs.type ==
INT && rhs.type ==
INT) {
40 return lhs.value.
i < rhs.value.
i;
41 }
else if (lhs.type ==
FLOAT && rhs.type ==
FLOAT) {
42 return lhs.value.
f < rhs.value.
f;
43 }
else if (lhs.type ==
INT && rhs.type ==
FLOAT) {
44 return lhs.value.
i < rhs.value.
f;
45 }
else if (lhs.type ==
FLOAT && rhs.type ==
INT) {
46 return lhs.value.
f < rhs.value.
i;
53 if (lhs.type ==
INT && rhs.type ==
INT) {
54 return lhs.value.
i > rhs.value.
i;
55 }
else if (lhs.type ==
FLOAT && rhs.type ==
FLOAT) {
56 return lhs.value.
f > rhs.value.
f;
57 }
else if (lhs.type ==
INT && rhs.type ==
FLOAT) {
58 return lhs.value.
i > rhs.value.
f;
59 }
else if (lhs.type ==
FLOAT && rhs.type ==
INT) {
60 return lhs.value.
f > rhs.value.
i;
111 if (type ==
INT && rhs.type ==
INT) {
112 return Number(value.
i + rhs.value.
i);
113 }
else if (type ==
FLOAT && rhs.type ==
FLOAT) {
114 return Number(value.
f + rhs.value.
f);
115 }
else if (type ==
INT && rhs.type ==
FLOAT) {
116 return Number(value.
i + rhs.value.
f);
117 }
else if (type ==
FLOAT && rhs.type ==
INT) {
118 return Number(value.
f + rhs.value.
i);
125 if (type ==
INT && rhs.type ==
INT) {
126 return Number(value.
i - rhs.value.
i);
127 }
else if (type ==
FLOAT && rhs.type ==
FLOAT) {
128 return Number(value.
f - rhs.value.
f);
129 }
else if (type ==
INT && rhs.type ==
FLOAT) {
130 return Number(value.
i - rhs.value.
f);
131 }
else if (type ==
FLOAT && rhs.type ==
INT) {
132 return Number(value.
f - rhs.value.
i);
139 if (type ==
INT && rhs.type ==
INT) {
140 return Number(value.
i * rhs.value.
i);
141 }
else if (type ==
FLOAT && rhs.type ==
FLOAT) {
142 return Number(value.
f * rhs.value.
f);
143 }
else if (type ==
INT && rhs.type ==
FLOAT) {
144 return Number(value.
i * rhs.value.
f);
145 }
else if (type ==
FLOAT && rhs.type ==
INT) {
146 return Number(value.
f * rhs.value.
i);
153 if (type ==
INT && rhs.type ==
INT) {
154 if (rhs.value.
i == 0) {
157 return Number(value.
i / rhs.value.
i);
158 }
else if (type ==
FLOAT && rhs.type ==
FLOAT) {
159 return Number(value.
f / rhs.value.
f);
160 }
else if (type ==
INT && rhs.type ==
FLOAT) {
161 return Number(value.
i / rhs.value.
f);
162 }
else if (type ==
FLOAT && rhs.type ==
INT) {
163 return Number(value.
f / rhs.value.
i);
170 if (type ==
INT && rhs.type ==
INT) {
171 if (rhs.value.
i == 0) {
174 return Number(value.
i % rhs.value.
i);
181 if (type ==
INT && rhs.type ==
INT) {
182 return Number((
int) pow(value.
i, rhs.value.
i));
183 }
else if (type ==
FLOAT && rhs.type ==
FLOAT) {
184 return Number(pow(value.
f, rhs.value.
f));
185 }
else if (type ==
INT && rhs.type ==
FLOAT) {
186 return Number(pow(value.
i, rhs.value.
f));
187 }
else if (type ==
FLOAT && rhs.type ==
INT) {
188 return Number(pow(value.
f, rhs.value.
i));
197 }
else if (type ==
FLOAT) {
bool operator!=(const Number &lhs, const Number &rhs)
Number operator%(const Number &) const
bool operator<=(const Number &lhs, const Number &rhs)
Number operator+(const Number &) const
bool operator>=(const Number &lhs, const Number &rhs)
bool operator>(const Number &lhs, const Number &rhs)
Number & operator^=(const Number &)
Number & operator-=(const Number &)
Number operator/(const Number &) const
Number & operator*=(const Number &)
Number & operator/=(const Number &)
Number & operator+=(const Number &)
ostream & operator<<(ostream &out, const Number &num)
Number & operator%=(const Number &)
Number operator^(const Number &) const
bool operator<(const Number &lhs, const Number &rhs)
Number & operator=(const Number &)
bool operator==(const Number &lhs, const Number &rhs)
Number operator*(const Number &) const