SpECTRE
v2024.09.29
|
A rational number. More...
#include <Rational.hpp>
Public Member Functions | |
Rational (std::int32_t numerator, std::int32_t denominator) | |
template<typename T , Requires< tt::is_integer_v< T > > = nullptr> | |
Rational (const T integral_value) | |
std::int32_t | numerator () const |
std::int32_t | denominator () const |
double | value () const |
Rational | inverse () const |
Rational & | operator+= (const Rational &other) |
Rational & | operator-= (const Rational &other) |
Rational & | operator*= (const Rational &other) |
Rational & | operator/= (const Rational &other) |
void | pup (PUP::er &p) |
Friends | |
Rational | operator- (Rational r) |
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.