|
| rational () noexcept |
| Empty constructor.
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
| rational (T n, uint64_t d=1) noexcept |
| Constructor with numerator and denominator. More...
|
|
| rational (const integer &n, const integer &d=1) noexcept |
| Constructor with numerator and denominator. More...
|
|
| rational (const std::string &s) noexcept |
| Constructor with string. More...
|
|
| rational (const rational &r) noexcept |
| Copy constructor. More...
|
|
| rational (integer &&i) noexcept |
| Move constructor. More...
|
|
| rational (integer &&n, integer &&d) noexcept |
| Move constructor with numerator and denominator. More...
|
|
| rational (rational &&r) noexcept |
| Move constructor. More...
|
|
| ~rational () noexcept |
| Destructor.
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
void | set_number (T n, uint64_t d=1) noexcept |
| Overwrites the value of this rational with \(n/d\). More...
|
|
void | set_str (const std::string &s) noexcept |
| Overwrites the value in the string s. More...
|
|
void | set_integer (const integer &n, const integer &d) noexcept |
| Overwrites the value of this rational with the value \(n/d\). More...
|
|
void | set_rational (const rational &r) noexcept |
| Overwrites the value of this rational with the value \(n/d\). More...
|
|
void | invert () noexcept |
| Changes numerator and denominator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
rational & | operator= (T i) noexcept |
| Assignment operator. More...
|
|
rational & | operator= (const std::string &s) noexcept |
| Assignment operator. More...
|
|
rational & | operator= (const integer &i) noexcept |
| Assignment operator. More...
|
|
rational & | operator= (const rational &r) noexcept |
| Assignment operator. More...
|
|
rational & | operator= (integer &&i) noexcept |
| Move assignment operator. More...
|
|
rational & | operator= (rational &&r) noexcept |
| Move assignment operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
bool | operator== (T i) const noexcept |
| Equality operator. More...
|
|
bool | operator== (const integer &i) const noexcept |
| Equality operator. More...
|
|
bool | operator== (const rational &r) const noexcept |
| Equality operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
bool | operator!= (T i) const noexcept |
| Non-equality operator. More...
|
|
bool | operator!= (const integer &i) const noexcept |
| Non-equality operator. More...
|
|
bool | operator!= (const rational &r) const noexcept |
| Non-equality operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
bool | operator< (T i) const noexcept |
| Less than operator. More...
|
|
bool | operator< (const integer &i) const noexcept |
| Less than operator. More...
|
|
bool | operator< (const rational &r) const noexcept |
| Less than operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
bool | operator<= (T i) const noexcept |
| Less than or equal to operator. More...
|
|
bool | operator<= (const integer &i) const noexcept |
| Less than or equal to operator. More...
|
|
bool | operator<= (const rational &r) const noexcept |
| Less than or equal to operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
bool | operator> (T i) const noexcept |
| Greater than operator. More...
|
|
bool | operator> (const integer &i) const noexcept |
| Greater than operator. More...
|
|
bool | operator> (const rational &r) const noexcept |
| Greater than operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
bool | operator>= (T i) const noexcept |
| Greater than or equal to operator. More...
|
|
bool | operator>= (const integer &i) const noexcept |
| Greater than or equal to operator. More...
|
|
bool | operator>= (const rational &r) const noexcept |
| Greater than or equal to operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
rational | operator+ (T i) const noexcept |
| Addition operator. More...
|
|
rational | operator+ (const integer &i) const noexcept |
| Addition operator. More...
|
|
rational | operator+ (const rational &r) const noexcept |
| Addition operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
rational & | operator+= (T i) noexcept |
| Addition operator. More...
|
|
rational & | operator+= (const integer &i) noexcept |
| Addition operator. More...
|
|
rational & | operator+= (const rational &r) noexcept |
| Addition operator. More...
|
|
rational | operator- () const noexcept |
| Substraction unary operator.
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
rational | operator- (T i) const noexcept |
| Substraction operator. More...
|
|
rational | operator- (const integer &i) const noexcept |
| Substraction operator. More...
|
|
rational | operator- (const rational &r) const noexcept |
| Substraction operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
rational & | operator-= (T i) noexcept |
| Substraction operator. More...
|
|
rational & | operator-= (const integer &i) noexcept |
| Substraction operator. More...
|
|
rational & | operator-= (const rational &r) noexcept |
| Substraction operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
rational | operator* (T i) const noexcept |
| Multiplication operator. More...
|
|
rational | operator* (const integer &i) const noexcept |
| Multiplication operator. More...
|
|
rational | operator* (const rational &r) const noexcept |
| Multiplication operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
rational & | operator*= (T i) noexcept |
| Multiplication operator. More...
|
|
rational & | operator*= (const integer &i) noexcept |
| Multiplication operator. More...
|
|
rational & | operator*= (const rational &r) noexcept |
| Multiplication operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
rational | operator/ (T i) const noexcept |
| Division operator. More...
|
|
rational | operator/ (const integer &i) const noexcept |
| Division operator. More...
|
|
rational | operator/ (const rational &r) const noexcept |
| Division operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
rational & | operator/= (T i) noexcept |
| Division operator. More...
|
|
rational & | operator/= (const integer &i) noexcept |
| Division operator. More...
|
|
rational & | operator/= (const rational &r) noexcept |
| Division operator. More...
|
|
rational | power (uint64_t i) const noexcept |
| Exponentiation operator. More...
|
|
rational | power (const integer &i) const noexcept |
| Exponentiation operator. More...
|
|
rational & | powt (uint64_t i) noexcept |
| Exponentiation operator. More...
|
|
rational & | powt (const integer &i) noexcept |
| Exponentiation operator. More...
|
|
bool | is_initialized () const noexcept |
| Returns whether this object is initialised or not.
|
|
int64_t | get_sign () const noexcept |
| Returns the sign of this rational.
|
|
std::size_t | bytes () const noexcept |
| Returns the amount of bytes this integer occupies.
|
|
integer | to_integer () const noexcept |
| Converts this rational to an integer value. More...
|
|
void | as_integer (integer &i) const noexcept |
| Converts this rational to an integer value. More...
|
|
double | to_double () const noexcept |
| Converts this rational to a double-precision floating-point value.
|
|
void | as_double (double &d) const noexcept |
| Converts this rational to a double-precision floating-point value.
|
|
std::string | to_string () const noexcept |
| Converts this integer to a string.
|
|
void | as_string (std::string &s) const noexcept |
| Converts this integer to a string.
|
|
integer | get_numerator () const noexcept |
| Returns the numerator of this rational number.
|
|
integer | get_denominator () const noexcept |
| Returns the denominator of this rational number.
|
|
void | swap (rational &r) noexcept |
| Swaps the value of this rational with rational r's value. More...
|
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
bool | operator== (T i, const rational &r) noexcept |
| Equality operator. More...
|
|
bool | operator== (const integer &i, const rational &r) noexcept |
| Equality operator. More...
|
|
bool | operator!= (int64_t i, const rational &r) noexcept |
| Non-equality operator. More...
|
|
bool | operator!= (const integer &i, const rational &r) noexcept |
| Non-equality operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
bool | operator< (T i, const rational &r) noexcept |
| Less than operator. More...
|
|
bool | operator< (const integer &i, const rational &r) noexcept |
| Less than operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
bool | operator<= (T i, const rational &r) noexcept |
| Less than or equal to operator. More...
|
|
bool | operator<= (const integer &i, const rational &r) noexcept |
| Less than or equal to operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
bool | operator> (T i, const rational &r) noexcept |
| Greater than operator. More...
|
|
bool | operator> (const integer &i, const rational &r) noexcept |
| Greater than operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
bool | operator>= (T i, const rational &r) noexcept |
| Greater than or equal to operator. More...
|
|
bool | operator>= (const integer &i, const rational &r) noexcept |
| Greater than or equal to operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
rational | operator+ (T i, const rational &r) noexcept |
| Addition operator. More...
|
|
rational | operator+ (const integer &i, const rational &r) noexcept |
| Addition operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
rational | operator- (T i, const rational &r) noexcept |
| Substraction operator. More...
|
|
rational | operator- (const integer &i, const rational &r) noexcept |
| Substraction operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
rational | operator* (T i, const rational &r) noexcept |
| Multiplication operator. More...
|
|
rational | operator* (const integer &i, const rational &r) noexcept |
| Multiplication operator. More...
|
|
template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> |
rational | operator/ (T i, const rational &r) noexcept |
| Division operator. More...
|
|
void | swap (rational &r1, rational &r2) noexcept |
| Swaps two rationals. More...
|
|