units
Use physical dimensions at compile-time or run-time.
Classes | Namespaces | Functions
rational.hpp File Reference

Definition of vnix::rat::rational and operators for it. More...

#include <iostream>
#include <vnix/rat/common-denom.hpp>
#include <vnix/rat/encoding.hpp>
Include dependency graph for rational.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  vnix::rat::rational< NB, DB >
 Model of a fixed-precision rational number. More...
 
struct  vnix::rat::rational< NB, DB >::dummy_arg
 

Namespaces

 vnix
 Thomas E. Vaughan's public software.
 
 vnix::rat
 Classes and functions supporting a model of a fixed-precision rational number.
 

Functions

template<unsigned NB1, unsigned DB1, unsigned NB2, unsigned DB2>
constexpr bool vnix::rat::operator== (rational< NB1, DB1 > r1, rational< NB2, DB2 > r2)
 Compare rationals for equality. More...
 
template<unsigned NB1, unsigned DB1, unsigned NB2, unsigned DB2>
constexpr bool vnix::rat::operator!= (rational< NB1, DB1 > r1, rational< NB2, DB2 > r2)
 Compare rationals for inequality. More...
 
template<unsigned NB1, unsigned DB1, unsigned NB2, unsigned DB2>
constexpr bool vnix::rat::operator<= (rational< NB1, DB1 > r1, rational< NB2, DB2 > r2)
 Compare for less-than-or-equal ordering with another rational. More...
 
template<unsigned NB1, unsigned DB1, unsigned NB2, unsigned DB2>
constexpr bool vnix::rat::operator< (rational< NB1, DB1 > r1, rational< NB2, DB2 > r2)
 Compare for less-than ordering with another rational. More...
 
template<unsigned NB1, unsigned DB1, unsigned NB2, unsigned DB2>
constexpr bool vnix::rat::operator>= (rational< NB1, DB1 > r1, rational< NB2, DB2 > r2)
 Compare for greater-than-or-equal ordering with another rational. More...
 
template<unsigned NB1, unsigned DB1, unsigned NB2, unsigned DB2>
constexpr bool vnix::rat::operator> (rational< NB1, DB1 > r1, rational< NB2, DB2 > r2)
 Compare for greater-than ordering with another rational. More...
 
template<unsigned NB, unsigned DB>
constexpr auto vnix::rat::operator+ (rational< NB, DB > r)
 Copy rational number by way of unary operator+. More...
 
template<unsigned NB, unsigned DB>
constexpr auto vnix::rat::operator- (rational< NB, DB > r)
 Negate rational number. More...
 
template<unsigned NB1, unsigned DB1, unsigned NB2, unsigned DB2>
constexpr auto vnix::rat::operator+ (rational< NB1, DB1 > r1, rational< NB2, DB2 > r2)
 Sum of two rational numbers. More...
 
template<unsigned NB1, unsigned DB1, unsigned NB2, unsigned DB2>
constexpr auto vnix::rat::operator- (rational< NB1, DB1 > r1, rational< NB2, DB2 > r2)
 Difference between two rational numbers. More...
 
template<unsigned NB1, unsigned DB1, unsigned NB2, unsigned DB2>
constexpr auto vnix::rat::operator* (rational< NB1, DB1 > r1, rational< NB2, DB2 > r2)
 Product of two rational numbers. More...
 
template<unsigned NB1, unsigned DB1, unsigned NB2, unsigned DB2>
constexpr auto vnix::rat::operator/ (rational< NB1, DB1 > r1, rational< NB2, DB2 > r2)
 Quotient of two rational numbers. More...
 
template<unsigned NB1, unsigned DB1>
constexpr auto vnix::rat::operator/ (rational< NB1, DB1 > r1, typename rational< NB1, DB1 >::stype r2)
 Quotient of two rational numbers. More...
 
template<unsigned NB, unsigned DB>
std::ostream & vnix::rat::operator<< (std::ostream &s, rational< NB, DB > r)
 Print rational number to output-stream. More...
 

Detailed Description

Definition of vnix::rat::rational and operators for it.

License: BSD Three-Clause; see LICENSE.

Definition in file rational.hpp.