#include <static_rational.hpp>
Public Types | |
typedef static_rational< N, D > | this_type |
typedef static_rational< Numerator, Denominator > | type |
static_rational<N,D> reduced by GCD | |
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 |
Static Private Attributes | |
static const integer_type | nabs = static_abs<N>::value |
static const integer_type | dabs = static_abs<D>::value |
static const integer_type | den |
greatest common divisor of N and D |
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):
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 produce floating point values.
Definition at line 74 of file static_rational.hpp.
typedef static_rational<N,D> mcs::units::static_rational< N, D >::this_type |
Definition at line 89 of file static_rational.hpp.
typedef static_rational<Numerator,Denominator> mcs::units::static_rational< N, D >::type |
mcs::units::static_rational< N, D >::static_rational | ( | ) | [inline] |
static integer_type mcs::units::static_rational< N, D >::numerator | ( | ) | [inline, static] |
Definition at line 94 of file static_rational.hpp.
References mcs::units::static_rational< N, D >::Numerator.
00094 { return Numerator; }
static integer_type mcs::units::static_rational< N, D >::denominator | ( | ) | [inline, static] |
Definition at line 95 of file static_rational.hpp.
References mcs::units::static_rational< N, D >::Denominator.
00095 { return Denominator; }
const integer_type mcs::units::static_rational< N, D >::nabs = static_abs<N>::value [static, private] |
Definition at line 77 of file static_rational.hpp.
const integer_type mcs::units::static_rational< N, D >::dabs = static_abs<D>::value [static, private] |
Definition at line 78 of file static_rational.hpp.
const integer_type mcs::units::static_rational< N, D >::den [static, private] |
Initial value:
static_cast<integer_type>(boost::math::static_gcd<nabs,dabs>::value)
Definition at line 82 of file static_rational.hpp.
const integer_type mcs::units::static_rational< N, D >::Numerator = N/den [static] |
Definition at line 86 of file static_rational.hpp.
Referenced by mcs::units::static_rational< N, D >::numerator().
const integer_type mcs::units::static_rational< N, D >::Denominator = D/den [static] |
Definition at line 87 of file static_rational.hpp.
Referenced by mcs::units::static_rational< N, D >::denominator().
Generated on Mon Apr 2 22:25:07 2007 for physical_svn by 1.5.1-p1 | hosted on |