libstdc++

Public Types  
typedef ratio< num, den >  type 
Public Member Functions  
static_assert (_Den!=0,"denominator cannot be zero")  
static_assert (_Num >=__INTMAX_MAX__ &&_Den >=__INTMAX_MAX__,"out of range") 
Static Public Attributes  
static constexpr intmax_t  den 
static constexpr intmax_t  num 
Provides compiletime rational arithmetic.
This class template represents any finite rational number with a numerator and denominator representable by compiletime constants of type intmax_t. The ratio is simplified when instantiated.
For example: