C++ Library Extensions 2022.12.09
To help learn modern C++ programming
cpg_rational.hpp File Reference
#include "cpg_types.hpp"
#include <numeric>
#include <cassert>
#include <cmath>
#include <compare>
#include <optional>
Include dependency graph for cpg_rational.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  cpg::rational_number::rational< ElementType >
 

Namespaces

namespace  cpg
 Includes subnamespace conversion.
 
namespace  cpg::rational_number
 

Concepts

concept  cpg::rational_number::real_number_c
 
concept  cpg::rational_number::allowed_type_c
 
concept  cpg::rational_number::number_c
 

Macros

#define NOMINMAX
 

Typedefs

using cpg::rational_number::real_number_list = types::type_container< float, double, long double >
 
using cpg::rational_number::allowed_type_list = types::type_container< char, signed char, unsigned char, short, unsigned short, int, unsigned int, long, unsigned long, long long, unsigned long long >
 
using cpg::rational_number::numerical_type_list = types::type_container< char, unsigned char, short, unsigned short, int, unsigned int, long, unsigned long, long long, unsigned long long, float, double, long double >
 

Functions

template<allowed_type_c ElementType>
constexpr ElementType cpg::rational_number::reduce_adjusted (ElementType &A, ElementType &B) noexcept
 
template<allowed_type_c ElementType>
constexpr ElementType cpg::rational_number::reduce_simple (ElementType &A, ElementType &B) noexcept
 
template<allowed_type_c T>
constexpr bool cpg::rational_number::tell_comparable_as_double ()
 
template<allowed_type_c L, allowed_type_c R>
requires ( !std::same_as<L, R>)
std::strong_ordering cpg::rational_number::operator<=> (rational< L > const &lhs, rational< R > const &rhs)
 
template<allowed_type_c L, allowed_type_c R>
requires ( !std::same_as<L, R>)
std::strong_ordering cpg::rational_number::operator<=> (rational< L > const &lhs, R rhs)
 
template<allowed_type_c L, real_number_c R>
std::strong_ordering cpg::rational_number::operator<=> (rational< L > const &lhs, R rhs)
 
template<allowed_type_c L, allowed_type_c R>
requires ( !std::same_as<L, R>)
bool cpg::rational_number::operator== (rational< L > const &lhs, rational< R > const &rhs)
 
template<allowed_type_c L, allowed_type_c R>
requires ( !std::same_as<L, R>)
bool cpg::rational_number::operator== (rational< L > const &lhs, R rhs)
 
template<allowed_type_c L, real_number_c R>
bool cpg::rational_number::operator== (rational< L > const &lhs, R rhs)
 
auto cpg::rational_number::factorial (unsigned long long n) noexcept
 
auto cpg::rational_number::nPr (unsigned long long n, unsigned long long r=1) noexcept
 
auto cpg::rational_number::nCr (unsigned long long n, unsigned long long r) noexcept
 

Macro Definition Documentation

◆ NOMINMAX

#define NOMINMAX

Definition at line 15 of file cpg_rational.hpp.