|
|
@@ -288,8 +288,31 @@ bool math::operator==(biginteger const & rhs, biginteger const & lhs) {
|
|
|
return rhs.is_negative == lhs.is_negative && detail::compare(rhs.data, lhs.data) == 0;
|
|
|
}
|
|
|
|
|
|
-biginteger const biginteger::ZERO{0}, biginteger::ONE{1}, biginteger::NEGATIVE_ONE{-1};
|
|
|
+bool math::operator!=(biginteger const & rhs, biginteger const & lhs) {
|
|
|
+ return !(rhs == lhs);
|
|
|
+}
|
|
|
+
|
|
|
+bool math::operator<=(biginteger const & rhs, biginteger const & lhs) {
|
|
|
+ return !(rhs > lhs);
|
|
|
+}
|
|
|
+
|
|
|
+bool math::operator< (biginteger const & rhs, biginteger const & lhs) {
|
|
|
+ if (rhs.is_negative != lhs.is_negative) { return rhs.is_negative; }
|
|
|
+ else if (rhs.is_negative) { return detail::compare(rhs.data, lhs.data) > 0; }
|
|
|
+ else { return detail::compare(rhs.data, lhs.data) < 0; }
|
|
|
+}
|
|
|
|
|
|
+bool math::operator>=(biginteger const & rhs, biginteger const & lhs) {
|
|
|
+ return !(rhs < lhs);
|
|
|
+}
|
|
|
+
|
|
|
+bool math::operator> (biginteger const & rhs, biginteger const & lhs) {
|
|
|
+ if (rhs.is_negative != lhs.is_negative) { return lhs.is_negative; }
|
|
|
+ else if (rhs.is_negative) { return detail::compare(rhs.data, lhs.data) < 0; }
|
|
|
+ else { return detail::compare(rhs.data, lhs.data) > 0; }
|
|
|
+}
|
|
|
+
|
|
|
+biginteger const biginteger::ZERO{0}, biginteger::ONE{1}, biginteger::NEGATIVE_ONE{-1};
|
|
|
|
|
|
std::string biginteger::to_string() const {
|
|
|
std::vector<char> output(biginteger::SEG_DIGITS * data.size() + 1, '\0');
|