Shaka Player Embedded
|
#include <utils.h>
Public Member Functions | |
Rational ()=default | |
Rational (T num, T den) | |
T | truncate () const |
Rational< T > | inverse () const |
operator bool () const | |
operator double () const | |
template<typename U > | |
bool | operator== (const Rational< U > &other) const |
template<typename U > | |
bool | operator!= (const Rational< U > &other) const |
template<typename U > | |
Rational< common< U > > | operator* (const Rational< U > &other) const |
template<typename U , typename = enable_if_num<U>> | |
Rational< common< U > > | operator* (U other) const |
template<typename U > | |
Rational< common< U > > | operator/ (const Rational< U > &other) const |
template<typename U , typename = enable_if_num<U>> | |
Rational< common< U > > | operator/ (U other) const |
Public Attributes | |
T | numerator |
T | denominator |
Defines a rational number (i.e. a fraction) in a way to reduce the number of rounding errors. Using the constructor or operators results in a reduced fraction, to reduce the chances of overflow. Since this uses a fixed-sized integer, this can still cause overflow with large numbers.
|
default |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
T shaka::Rational< T >::denominator |
T shaka::Rational< T >::numerator |