Compiletime rational arithmetic
From cppreference.com
The class template std::ratio
and associated templates provide compiletime rational arithmetic support. Each instantiation of this template exactly represents any finite rational number.
[edit] Compiletime fractions
Defined in header
<ratio> 

represents exact rational fraction (class template) 
Several convenience typedefs that correspond to the SI ratios are provided by the standard library:
Defined in header
<ratio> 

Type  Definition 
yocto

std::ratio<1, 1000000000000000000000000>, if std::intmax_t can represent the denominator 
zepto

std::ratio<1, 1000000000000000000000>, if std::intmax_t can represent the denominator 
atto

std::ratio<1, 1000000000000000000> 
femto

std::ratio<1, 1000000000000000> 
pico

std::ratio<1, 1000000000000> 
nano

std::ratio<1, 1000000000> 
micro

std::ratio<1, 1000000> 
milli

std::ratio<1, 1000> 
centi

std::ratio<1, 100> 
deci

std::ratio<1, 10> 
deca

std::ratio<10, 1> 
hecto

std::ratio<100, 1> 
kilo

std::ratio<1000, 1> 
mega

std::ratio<1000000, 1> 
giga

std::ratio<1000000000, 1> 
tera

std::ratio<1000000000000, 1> 
peta

std::ratio<1000000000000000, 1> 
exa

std::ratio<1000000000000000000, 1> 
zetta

std::ratio<1000000000000000000000, 1>, if std::intmax_t can represent the numerator 
yotta

std::ratio<1000000000000000000000000, 1>, if std::intmax_t can represent the numerator 
[edit] Compiletime rational arithmetic
Several alias templates, that perform arithmetic operations on ratio
objects at compiletime are provided.
Defined in header
<ratio> 

(C++11)

adds two ratio objects at compiletime (alias template) 
(C++11)

subtracts two ratio objects at compiletime (alias template) 
(C++11)

multiplies two ratio objects at compiletime (alias template) 
(C++11)

divides two ratio objects at compiletime (alias template) 
[edit] Compiletime rational comparison
Several class templates, that perform comparison operations on ratio
objects at compiletime are provided.
Defined in header
<ratio> 

(C++11)

compares two ratio objects for equality at compiletime (class template) 
(C++11)

compares two ratio objects for inequality at compiletime (class template) 
(C++11)

compares two ratio objects for less than at compiletime (class template) 
(C++11)

compares two ratio objects for less than or equal to at compiletime (class template) 
(C++11)

compares two ratio objects for greater than at compiletime (class template) 
(C++11)

compares two ratio objects for greater than or equal to at compiletime (class template) 