[ratio.syn]

# 21 Metaprogramming library [[meta]](./#meta)

## 21.5 Compile-time rational arithmetic [[ratio]](ratio#syn)

### 21.5.2 Header <ratio> synopsis [ratio.syn]

// all freestandingnamespace std {// [[ratio.ratio]](ratio.ratio "21.5.3 Class template ratio"), class template ratiotemplate<intmax_t N, intmax_t D = 1> class ratio; // [[ratio.arithmetic]](ratio.arithmetic "21.5.4 Arithmetic on ratios"), ratio arithmetictemplate<class R1, class R2> using ratio_add = *see below*; template<class R1, class R2> using ratio_subtract = *see below*; template<class R1, class R2> using ratio_multiply = *see below*; template<class R1, class R2> using ratio_divide = *see below*; // [[ratio.comparison]](ratio.comparison "21.5.5 Comparison of ratios"), ratio comparisontemplate<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; template<class R1, class R2>constexpr bool [ratio_equal_v](#lib:ratio_equal_v "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio_equal<R1, R2>::value; template<class R1, class R2>constexpr bool [ratio_not_equal_v](#lib:ratio_not_equal_v "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio_not_equal<R1, R2>::value; template<class R1, class R2>constexpr bool [ratio_less_v](#lib:ratio_less_v "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio_less<R1, R2>::value; template<class R1, class R2>constexpr bool [ratio_less_equal_v](#lib:ratio_less_equal_v "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio_less_equal<R1, R2>::value; template<class R1, class R2>constexpr bool [ratio_greater_v](#lib:ratio_greater_v "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio_greater<R1, R2>::value; template<class R1, class R2>constexpr bool [ratio_greater_equal_v](#lib:ratio_greater_equal_v "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio_greater_equal<R1, R2>::value; // [[ratio.si]](ratio.si "21.5.6 SI types for ratio"), convenience SI typedefsusing [quecto](ratio.si#lib:quecto "21.5.6 SI types for ratio [ratio.si]") = ratio<1, 1'000'000'000'000'000'000'000'000'000'000>; // *see below*using [ronto](ratio.si#lib:ronto "21.5.6 SI types for ratio [ratio.si]") = ratio<1, 1'000'000'000'000'000'000'000'000'000>; // *see below*using [yocto](ratio.si#lib:yocto "21.5.6 SI types for ratio [ratio.si]") = ratio<1, 1'000'000'000'000'000'000'000'000>; // *see below*using [zepto](ratio.si#lib:zepto "21.5.6 SI types for ratio [ratio.si]") = ratio<1, 1'000'000'000'000'000'000'000>; // *see below*using [atto](#lib:atto "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio<1, 1'000'000'000'000'000'000>; using [femto](#lib:femto "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio<1, 1'000'000'000'000'000>; using [pico](#lib:pico "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio<1, 1'000'000'000'000>; using [nano](#lib:nano "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio<1, 1'000'000'000>; using [micro](#lib:micro "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio<1, 1'000'000>; using [milli](#lib:milli "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio<1, 1'000>; using [centi](#lib:centi "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio<1, 100>; using [deci](#lib:deci "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio<1, 10>; using [deca](#lib:deca "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio< 10, 1>; using [hecto](#lib:hecto "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio< 100, 1>; using [kilo](#lib:kilo "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio< 1'000, 1>; using [mega](#lib:mega "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio< 1'000'000, 1>; using [giga](#lib:giga "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio< 1'000'000'000, 1>; using [tera](#lib:tera "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio< 1'000'000'000'000, 1>; using [peta](#lib:peta "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio< 1'000'000'000'000'000, 1>; using [exa](#lib:exa "21.5.2 Header <ratio> synopsis [ratio.syn]") = ratio< 1'000'000'000'000'000'000, 1>; using [zetta](ratio.si#lib:zetta "21.5.6 SI types for ratio [ratio.si]") = ratio< 1'000'000'000'000'000'000'000, 1>; // *see below*using [yotta](ratio.si#lib:yotta "21.5.6 SI types for ratio [ratio.si]") = ratio< 1'000'000'000'000'000'000'000'000, 1>; // *see below*using [ronna](ratio.si#lib:ronna "21.5.6 SI types for ratio [ratio.si]") = ratio< 1'000'000'000'000'000'000'000'000'000, 1>; // *see below*using [quetta](ratio.si#lib:quetta "21.5.6 SI types for ratio [ratio.si]") = ratio<1'000'000'000'000'000'000'000'000'000'000, 1>; // *see below*}
