Represents a rational number consisting of its corresponding numerator and denominator.
More...
#include <rational.hpp>
|
constexpr | rational (const rational &)=default |
|
constexpr | rational (rational &&) noexcept=default |
|
constexpr | rational (std::int64_t numerator) noexcept |
|
constexpr | rational (std::int64_t numerator, std::int64_t denominator) noexcept |
|
template<typename T >
requires (std::is_aggregate_v<std::decay_t<T>> && similar_rational<std::decay_t<T>>) |
constexpr | rational (T &&obj) noexcept |
|
rational & | operator= (const rational &)=default |
|
rational & | operator= (rational &&) noexcept=default |
|
template<typename T >
requires similar_rational<std::decay_t<T>> |
constexpr | operator T () const noexcept(similar_rational< std::decay_t< T > >) |
| Converts to a similar object.
|
|
template<std::floating_point T> |
constexpr | operator T () const noexcept |
| Converts to a floating-point number.
|
|
constexpr void | simplify () noexcept |
|
constexpr rational | reciprocal () const noexcept |
| Gets the reciprocal of the rational.
|
|
constexpr bool | operator< (const rational &right) const noexcept |
|
constexpr bool | operator> (const rational &right) const noexcept |
|
constexpr bool | operator== (const rational &right) const noexcept |
|
constexpr bool | operator!= (const rational &right) const noexcept |
|
constexpr bool | operator<= (const rational &right) const noexcept |
|
constexpr bool | operator>= (const rational &right) const noexcept |
|
|
std::int64_t | numerator {} |
|
std::int64_t | denominator {} |
|
Represents a rational number consisting of its corresponding numerator and denominator.
◆ operator T() [1/2]
template<std::floating_point T>
essence::rational::operator T |
( |
| ) |
const |
|
inlineexplicitconstexprnoexcept |
Converts to a floating-point number.
- Template Parameters
-
T | The type of the floating-point number. |
◆ operator T() [2/2]
template<typename T >
requires similar_rational<std::decay_t<T>>
essence::rational::operator T |
( |
| ) |
const |
|
inlineconstexprnoexcept |
Converts to a similar object.
- Template Parameters
-
T | The type of the similar object. |
◆ reciprocal()
rational essence::rational::reciprocal |
( |
| ) |
const |
|
inlinenodiscardconstexprnoexcept |
Gets the reciprocal of the rational.
- Returns
- The reciprocal.
The documentation for this struct was generated from the following file: