diff --git a/fastmath.hpp b/fastmath.hpp index 751e042..bdf7ebf 100644 --- a/fastmath.hpp +++ b/fastmath.hpp @@ -55,6 +55,12 @@ struct decimal { friend bool operator>(const decimal &d1, const decimal &d2) { return d1.i > d2.i; } + friend bool operator<=(const decimal &d1, const decimal &d2) { + return d1.i <= d2.i; + } + friend bool operator>=(const decimal &d1, const decimal &d2) { + return d1.i >= d2.i; + } friend bool operator==(const decimal &d1, const decimal &d2) { return d1.i == d2.i; @@ -62,7 +68,6 @@ struct decimal { friend bool operator!=(const decimal &d1, const decimal &d2) { return d1.i != d2.i; } - decimal &operator=(decimal const &in) { if (this != &in) { std::destroy_at(this); @@ -155,6 +160,13 @@ template struct vec { } return res; } + bool isSmall() { + for (int i = 0; i < n; i++) { + if (abs(v[i].i) > (1 << (HALF_SHIFT - 1))) + return false; + } + return true; + } decimal &operator[](const int &i) { return v[i]; } decimal len_sq() { return *this * *this; }