This is an implementation of a compile time rational number, where static_rational<N,D>
represents a rational number with numerator N
and denominator D
.
More...
#include <static_rational.hpp>
Public Types | |
typedef detail::static_rational_tag | tag |
typedef static_rational< N, D > | this_type |
INTERNAL ONLY. More... | |
typedef static_rational < Numerator, Denominator > | type |
static_rational<N,D> reduced by GCD More... | |
Public Member Functions | |
static_rational () | |
Static Public Member Functions | |
static integer_type | numerator () |
static integer_type | denominator () |
Static Public Attributes | |
static const integer_type | Numerator = N/den |
static const integer_type | Denominator = D/den |
This is an implementation of a compile time rational number, where static_rational<N,D>
represents a rational number with numerator N
and denominator D
.
Because of the potential for ambiguity arising from multiple equivalent values of static_rational
(e.g. static_rational<6,2>==static_rational<3>
), static rationals should always be accessed through static_rational<N,D>::type
. Template specialization prevents instantiation of zero denominators (i.e. static_rational<N,0>
). The following compile-time arithmetic operators are provided for static_rational variables only (no operators are defined between long and static_rational):
mpl::negate
mpl::plus
mpl::minus
mpl::times
mpl::divides
Neither static_power
nor static_root
are defined for static_rational
. This is because template types may not be floating point values, while powers and roots of rational numbers can produce floating point values.
typedef detail::static_rational_tag boost::units::static_rational< N, D >::tag |
typedef static_rational<N,D> boost::units::static_rational< N, D >::this_type |
INTERNAL ONLY.
typedef static_rational<Numerator,Denominator> boost::units::static_rational< N, D >::type |
static_rational<N,D> reduced by GCD
|
inline |
|
inlinestatic |
|
inlinestatic |
References boost::units::static_rational< N, D >::Numerator.
|
static |
Referenced by boost::units::static_rational< N, D >::denominator().
|
static |
Referenced by boost::units::static_rational< N, D >::numerator().