# 20 General utilities library [utilities]

## 20.11 Compile-time rational arithmetic [ratio]

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

```namespace std
// [ratio.ratio], class template ratio
template <intmax_t N, intmax_t D = 1> class ratio;

// [ratio.arithmetic], ratio arithmetic
template <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
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;

// [ratio.si], convenience SI typedefs
typedef ratio<1, 1'000'000'000'000'000'000'000'000> yocto;  // see below
typedef ratio<1,     1'000'000'000'000'000'000'000> zepto;  // see below
typedef ratio<1,         1'000'000'000'000'000'000> atto;
typedef ratio<1,             1'000'000'000'000'000> femto;
typedef ratio<1,                 1'000'000'000'000> pico;
typedef ratio<1,                     1'000'000'000> nano;
typedef ratio<1,                         1'000'000> micro;
typedef ratio<1,                             1'000> milli;
typedef ratio<1,                               100> centi;
typedef ratio<1,                                10> deci;
typedef ratio<                               10, 1> deca;
typedef ratio<                              100, 1> hecto;
typedef ratio<                            1'000, 1> kilo;
typedef ratio<                        1'000'000, 1> mega;
typedef ratio<                    1'000'000'000, 1> giga;
typedef ratio<                1'000'000'000'000, 1> tera;
typedef ratio<            1'000'000'000'000'000, 1> peta;
typedef ratio<        1'000'000'000'000'000'000, 1> exa;
typedef ratio<    1'000'000'000'000'000'000'000, 1> zetta;  // see below
typedef ratio<1'000'000'000'000'000'000'000'000, 1> yotta;  // see below

```