![]() |
C++ Library Extensions 2022.12.09
To help learn modern C++ programming
|
#include <cpg_rational.hpp>
Public Types | |
using | value_type = ElementType |
Public Member Functions | |
constexpr void | reduce () noexcept |
constexpr | rational () noexcept=default |
constexpr | rational (ElementType numerator) noexcept |
constexpr | rational (ElementType numerator, ElementType denominator, bool DoNotReduce=false) noexcept |
constexpr rational | abs () const noexcept |
template<typename Type = ElementType> | |
Type | mag () const noexcept |
template<typename Type = ElementType> | |
Type | abs_mag () const noexcept |
constexpr | ~rational () |
constexpr bool | valid () const noexcept |
constexpr | operator bool () const noexcept |
constexpr bool | operator! () const noexcept |
constexpr const ElementType & | num () const noexcept |
constexpr const ElementType & | den () const noexcept |
constexpr ElementType | num (ElementType new_value, bool DoNotReduce=false) noexcept |
constexpr ElementType | den (ElementType new_value, bool DoNotReduce=false) noexcept |
constexpr rational | operator() (ElementType numerator, ElementType denominator, bool DoNotReduce=false) noexcept |
constexpr void | set (ElementType numerator, ElementType denominator, bool DoNotReduce=false) noexcept |
constexpr const rational & | operator++ () noexcept |
constexpr const rational & | operator-- () noexcept |
constexpr rational | operator++ (int) noexcept |
constexpr rational | operator-- (int) noexcept |
template<number_c Type = long long> | |
constexpr | operator Type () const noexcept |
template<allowed_type_c TargetType = ElementType, real_number_c RoundType = long double> | |
TargetType | round () const noexcept |
constexpr rational | reciprocal () const noexcept |
constexpr rational & | operator*= (const rational &rhs) noexcept |
constexpr rational & | operator/= (const rational &rhs) noexcept |
constexpr rational & | operator*= (ElementType rhs) noexcept |
constexpr rational & | operator/= (ElementType rhs) noexcept |
constexpr rational | inverse () const noexcept |
constexpr rational | operator- () const noexcept |
constexpr rational & | operator+= (const rational &rhs) noexcept |
constexpr rational & | operator-= (const rational &rhs) noexcept |
constexpr rational & | operator+= (ElementType rhs) noexcept |
constexpr rational & | operator-= (ElementType rhs) noexcept |
Public Attributes | |
ElementType | m_num = 0 |
ElementType | m_den = 1 |
Friends | |
constexpr std::strong_ordering | operator<=> (const rational &lhs, const rational &rhs) |
constexpr std::strong_ordering | operator<=> (const rational &lhs, ElementType rhs) noexcept |
constexpr bool | operator== (const rational &lhs, const rational &rhs) noexcept |
constexpr bool | operator== (const rational &lhs, ElementType rhs) noexcept |
constexpr rational | operator* (ElementType lhs, rational rhs) noexcept |
constexpr rational | operator* (rational lhs, ElementType rhs) noexcept |
constexpr rational | operator/ (ElementType lhs, const rational &rhs) noexcept |
constexpr rational | operator/ (const rational &lhs, ElementType rhs) noexcept |
constexpr rational | operator* (rational lhs, const rational &rhs) noexcept |
constexpr rational | operator/ (rational lhs, const rational &rhs) noexcept |
constexpr rational | operator+ (rational lhs, const rational &rhs) noexcept |
constexpr rational | operator- (rational lhs, const rational &rhs) noexcept |
constexpr rational | operator+ (ElementType lhs, rational rhs) noexcept |
constexpr rational | operator- (ElementType lhs, const rational &rhs) noexcept |
constexpr rational | operator+ (rational lhs, ElementType rhs) noexcept |
constexpr rational | operator- (rational lhs, ElementType rhs) noexcept |
template<typename CharType > | |
std::basic_ostream< CharType > & | operator<< (std::basic_ostream< CharType > &os, const rational &r) noexcept |
Definition at line 127 of file cpg_rational.hpp.
using cpg::rational_number::rational< ElementType >::value_type = ElementType |
Definition at line 131 of file cpg_rational.hpp.
|
constexprdefaultnoexcept |
|
inlineexplicitconstexprnoexcept |
Definition at line 144 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
Definition at line 147 of file cpg_rational.hpp.
|
inlineconstexpr |
Definition at line 193 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
Definition at line 155 of file cpg_rational.hpp.
|
inlinenoexcept |
Definition at line 178 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
Definition at line 221 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Definition at line 523 of file cpg_rational.hpp.
|
inlinenoexcept |
Definition at line 162 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
Definition at line 215 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Definition at line 315 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Definition at line 423 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
Definition at line 445 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
Definition at line 281 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
Definition at line 297 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Definition at line 615 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
Definition at line 529 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
Definition at line 289 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
Definition at line 307 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Definition at line 634 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Definition at line 472 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Definition at line 136 of file cpg_rational.hpp.
|
inlinenoexcept |
Definition at line 322 of file cpg_rational.hpp.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
friend |
Definition at line 461 of file cpg_rational.hpp.
|
friend |
Definition at line 509 of file cpg_rational.hpp.
|
friend |
Definition at line 467 of file cpg_rational.hpp.
|
friend |
Definition at line 654 of file cpg_rational.hpp.
|
friend |
Definition at line 604 of file cpg_rational.hpp.
|
friend |
Definition at line 674 of file cpg_rational.hpp.
|
friend |
Definition at line 660 of file cpg_rational.hpp.
|
friend |
Definition at line 610 of file cpg_rational.hpp.
|
friend |
Definition at line 680 of file cpg_rational.hpp.
|
friend |
Definition at line 494 of file cpg_rational.hpp.
|
friend |
Definition at line 487 of file cpg_rational.hpp.
|
friend |
Definition at line 515 of file cpg_rational.hpp.
|
friend |
Definition at line 686 of file cpg_rational.hpp.
|
friend |
Definition at line 328 of file cpg_rational.hpp.
|
friend |
Definition at line 378 of file cpg_rational.hpp.
|
friend |
Definition at line 384 of file cpg_rational.hpp.
|
friend |
Definition at line 393 of file cpg_rational.hpp.
ElementType cpg::rational_number::rational< ElementType >::m_den = 1 |
Definition at line 134 of file cpg_rational.hpp.
ElementType cpg::rational_number::rational< ElementType >::m_num = 0 |
Definition at line 133 of file cpg_rational.hpp.