libstdc++: std::ratio< _Num, _Den > Struct Template Reference

libstdc++

std::ratio< _Num, _Den > Struct Template Reference
Utilities » Rational Arithmetic

`#include <ratio>`

## Public Types
typedef ratio< num, den > | type

## Static Public Attributes
static constexpr intmax_t | den
static constexpr intmax_t | num

## Detailed Description

template<intmax_t _Num, intmax_t _Den = 1>
struct std::ratio< _Num, _Den >

Provides compile-time rational arithmetic.

This class template represents any finite rational number with a numerator and denominator representable by compile-time constants of type intmax_t. The ratio is simplified when instantiated.

For example:

std::ratio<7,-21>::num == -1;
std::ratio<7,-21>::den == 3;
std::ratio
Provides compile-time rational arithmetic.
Definition ratio:272

Definition at line 271 of file ratio.

## Member Typedef Documentation

## ◆ type

template<intmax_t _Num, intmax_t _Den = 1>

typedef ratio<num, den> std::ratio< _Num, _Den >::type

Definition at line 284 of file ratio.

## Member Data Documentation

## ◆ den

template<intmax_t _Num, intmax_t _Den = 1>

intmax_t std::ratio< _Num, _Den >::den
| staticconstexpr

Definition at line 281 of file ratio.

## ◆ num

template<intmax_t _Num, intmax_t _Den = 1>

intmax_t std::ratio< _Num, _Den >::num
| staticconstexpr

Definition at line 278 of file ratio.

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

- ratio