The <ratio> header provides support for compile-time rational arithmetic.
namespace std { template<intmax_t N,intmax_t D=1> class ratio; // ratio arithmetic template <class R1, class R2> struct ratio_add; template <class R1, class R2> struct ratio_subtract; template <class R1, class R2> struct ratio_multiply; template <class R1, class R2> struct ratio_divide; // ratio comparison template <class R1, class R2> struct ratio_equal; template <class R1, class R2> struct ratio_not_equal; template <class R1, class R2> struct ratio_less; template <class R1, class R2> struct ratio_less_equal; template <class R1, class R2> struct ratio_greater; template <class R1, class R2> struct ratio_greater_equal; typedef ratio<1, 1000000000000000000> atto; typedef ratio<1, 1000000000000000> femto; typedef ratio<1, 1000000000000> pico; typedef ratio<1, 1000000000> nano; typedef ratio<1, 1000000> micro; typedef ratio<1, 1000> milli; typedef ratio<1, 100> centi; typedef ratio<1, 10> deci; typedef ratio<10, 1> deca; typedef ratio<100, 1> hecto; typedef ratio<1000, 1> kilo; typedef ratio<1000000, 1> mega; typedef ratio<1000000000, 1> giga; typedef ratio<1000000000000, 1> tera; typedef ratio<1000000000000000, 1> peta; typedef ratio<1000000000000000000, 1> exa; }
See Also
-
just::threadHeaders -
std::ratioclass template -
std::ratio_addclass template -
std::ratio_subclass template -
std::ratio_multiplyclass template -
std::ratio_divideclass template -
std::ratio_equalclass template -
std::ratio_not_equalclass template -
std::ratio_lessclass template -
std::ratio_greaterclass template -
std::ratio_less_equalclass template -
std::ratio_greater_equalclass template