Public Member Functions | Friends | List of all members
Rational Class Reference

#include <Rational.hpp>

Public Member Functions

 Rational (std::int32_t numerator=0, std::int32_t denominator=1) noexcept
 
std::int32_t numerator () const noexcept
 
std::int32_t denominator () const noexcept
 
double value () const noexcept
 
Rational inverse () const noexcept
 
Rationaloperator+= (const Rational &other) noexcept
 
Rationaloperator-= (const Rational &other) noexcept
 
Rationaloperator*= (const Rational &other) noexcept
 
Rationaloperator/= (const Rational &other) noexcept
 
void pup (PUP::er &p) noexcept
 

Friends

Rational operator- (Rational r) noexcept
 

Detailed Description

A rational number

This serves as a faster replacement for boost::rational<std::int32_t>. As of Boost 1.65.0, arithmetic operators average about twice as fast, and ordering operators are about eight times as fast.


The documentation for this class was generated from the following files: