NTLib - Number Theory Library 0.9
Loading...
Searching...
No Matches
rational Module Reference

Provides a class template for rational numbers. More...

Classes

class  ntlib::rational< T >
 Represents a rational number. More...
class  ntlib::algebra_traits< rational< T > >
 Specialization of ntlib::algebra_traits for rational. More...

Functions

template<Integer T>
std::string ntlib::to_string (const rational< T > &r)
 Creates a string "a/b" where a and b are coprime.
template<Integer T>
std::ostream & ntlib::operator<< (std::ostream &os, const rational< T > &r)
 Stream insertion operator.
template<Integer T>
bool ntlib::operator== (const rational< T > &lhs, const rational< T > &rhs)
 Equality operator.
template<Integer T>
std::strong_ordering ntlib::operator<=> (const rational< T > &lhs, const rational< T > &rhs)
 Three-way comparison operator.
template<Integer T>
rational< T > ntlib::operator- (const rational< T > &r)
 Unary minus operator.

Detailed Description

Provides a class template for rational numbers.

Files

file  modules/types/rational.cpp
 Primary module interface unit for module rational.