Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::units::static_rational< N, D > Class Template Reference

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
 

Detailed Description

template<integer_type N, integer_type D = 1>
class boost::units::static_rational< N, 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):

  • 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.

Member Typedef Documentation

template<integer_type N, integer_type D = 1>
typedef detail::static_rational_tag boost::units::static_rational< N, D >::tag
template<integer_type N, integer_type D = 1>
typedef static_rational<N,D> boost::units::static_rational< N, D >::this_type

INTERNAL ONLY.

template<integer_type N, integer_type D = 1>
typedef static_rational<Numerator,Denominator> boost::units::static_rational< N, D >::type

static_rational<N,D> reduced by GCD

Constructor & Destructor Documentation

template<integer_type N, integer_type D = 1>
boost::units::static_rational< N, D >::static_rational ( )
inline

Member Function Documentation

template<integer_type N, integer_type D = 1>
static integer_type boost::units::static_rational< N, D >::denominator ( )
inlinestatic
template<integer_type N, integer_type D = 1>
static integer_type boost::units::static_rational< N, D >::numerator ( )
inlinestatic

Member Data Documentation

template<integer_type N, integer_type D = 1>
const integer_type boost::units::static_rational< N, D >::Denominator = D/den
static
template<integer_type N, integer_type D = 1>
const integer_type boost::units::static_rational< N, D >::Numerator = N/den
static

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