Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
std::ratio< N, D > Class Template Reference

A compile-time ratio of two integers, automatically reduced to lowest terms. More...

Public Types

using type = ratio<num, den>
 The type of an equivalent ratio whose reduced numerator and denominator are the same as this ratio.
 

Static Public Attributes

static constexpr intmax_t den {::arene::base::abs(D) / gcd}
 The denominator of the ratio, reduced to lowest terms.
 
static constexpr intmax_t num {d_sign * N / gcd}
 The numerator of the ratio, reduced to lowest terms.
 

Detailed Description

template<intmax_t N, intmax_t D = 1>
class std::ratio< N, D >

A compile-time ratio of two integers, automatically reduced to lowest terms.

Template Parameters
NThe unreduced numerator of the ratio
DThe unreduced denominator of the ratio
Precondition
The denominator must not be 0, and both numerator and denominator must have representable absolute values

Member Typedef Documentation

◆ type

template<intmax_t N, intmax_t D = 1>
using std::ratio< N, D >::type = ratio<num, den>

The type of an equivalent ratio whose reduced numerator and denominator are the same as this ratio.

Member Data Documentation

◆ den

template<intmax_t N, intmax_t D = 1>
intmax_t std::ratio< N, D >::den {::arene::base::abs(D) / gcd}
staticconstexpr

The denominator of the ratio, reduced to lowest terms.

◆ num

template<intmax_t N, intmax_t D = 1>
intmax_t std::ratio< N, D >::num {d_sign * N / gcd}
staticconstexpr

The numerator of the ratio, reduced to lowest terms.


The documentation for this class was generated from the following file: