tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches

Compile-time rational arithmetic. More...

Classes

struct  ratio< Num, Denom >
 The typename template provides compile-time rational arithmetic support. Each instantiation of this template exactly represents any finite rational number as long as its numerator Num and denominator Denom are representable as compile-time constants of type intmax_t. More...
 
struct  ratio_equal< R1, R2 >
 Compares two ratio objects for equality at compile-time. If the ratios R1 and R2 are equal, provides the member constant value equal true. Otherwise, value is false. More...
 
struct  ratio_greater< R1, R2 >
 Compares two ratio objects for equality at compile-time. If the ratio R1 is greater than the ratio R2, provides the member constant value equal true. Otherwise, value is false. More...
 
struct  ratio_greater_equal< R1, R2 >
 Compares two ratio objects for equality at compile-time. If the ratio R1 is greater than or equal to the ratio R2, provides the member constant value equal true. Otherwise, value is false. More...
 
struct  ratio_less< R1, R2 >
 Compares two ratio objects for equality at compile-time. If the ratio R1 is less than the ratio R2, provides the member constant value equal true. Otherwise, value is false. More...
 
struct  ratio_less_equal< R1, R2 >
 Compares two ratio objects for equality at compile-time. If the ratio R1 is less than or equal to the ratio R2, provides the member constant value equal true. Otherwise, value is false. More...
 
struct  ratio_not_equal< R1, R2 >
 Compares two ratio objects for equality at compile-time. If the ratios R1 and R2 are not equal, provides the member constant value equal true. Otherwise, value is false. More...
 

Typedefs

template<typename R1, typename R2>
using ratio_add = ratio<R1::num * R2::den + R2::num * R1::den, R1::den * R2::den>
 The alias template ratio_add denotes the result of adding two exact rational fractions represented by the ratio specializations R1 and R2.
 
template<typename R1, typename R2>
using ratio_divide = ratio<R1::num * R2::den, R1::den * R2::num>
 The alias template ratio_divide denotes the result of dividing two exact rational fractions represented by the ratio specializations R1 and R2.
 
template<typename R1, typename R2>
using ratio_multiply = ratio<R1::num * R2::num, R1::den * R2::den>
 The alias template ratio_multiply denotes the result of multiplying two exact rational fractions represented by the ratio specializations R1 and R2.
 
template<typename R1, typename R2>
using ratio_subtract = ratio<R1::num * R2::den - R2::num * R1::den, R1::den * R2::den>
 The alias template ratio_subtract denotes the result of subtracting two exact rational fractions represented by the ratio specializations R1 and R2.
 

Variables

template<typename R1, typename R2>
constexpr bool ratio_equal_v = ratio_equal<R1, R2>::value
 
template<typename R1, typename R2>
constexpr bool ratio_greater_equal_v = ratio_greater_equal<R1, R2>::value
 
template<typename R1, typename R2>
constexpr bool ratio_greater_v = ratio_greater<R1, R2>::value
 
template<typename R1, typename R2>
constexpr bool ratio_less_equal_v = ratio_less_equal<R1, R2>::value
 
template<typename R1, typename R2>
constexpr bool ratio_less_v = ratio_less<R1, R2>::value
 
template<typename R1, typename R2>
constexpr bool ratio_not_equal_v = ratio_not_equal<R1, R2>::value
 

Detailed Description

Compile-time rational arithmetic.

Typedef Documentation

◆ ratio_add

template<typename R1, typename R2>
using ratio_add = ratio<R1::num * R2::den + R2::num * R1::den, R1::den * R2::den>

The alias template ratio_add denotes the result of adding two exact rational fractions represented by the ratio specializations R1 and R2.

◆ ratio_divide

template<typename R1, typename R2>
using ratio_divide = ratio<R1::num * R2::den, R1::den * R2::num>

The alias template ratio_divide denotes the result of dividing two exact rational fractions represented by the ratio specializations R1 and R2.

◆ ratio_multiply

template<typename R1, typename R2>
using ratio_multiply = ratio<R1::num * R2::num, R1::den * R2::den>

The alias template ratio_multiply denotes the result of multiplying two exact rational fractions represented by the ratio specializations R1 and R2.

◆ ratio_subtract

template<typename R1, typename R2>
using ratio_subtract = ratio<R1::num * R2::den - R2::num * R1::den, R1::den * R2::den>

The alias template ratio_subtract denotes the result of subtracting two exact rational fractions represented by the ratio specializations R1 and R2.

Variable Documentation

◆ ratio_equal_v

template<typename R1, typename R2>
template<typename R1, typename R2>
bool ratio_equal_v = ratio_equal<R1, R2>::value
related

◆ ratio_greater_equal_v

template<typename R1, typename R2>
template<typename R1, typename R2>
bool ratio_greater_equal_v = ratio_greater_equal<R1, R2>::value
related

◆ ratio_greater_v

template<typename R1, typename R2>
bool ratio_greater_v = ratio_greater<R1, R2>::value
inlineconstexpr

◆ ratio_less_equal_v

template<typename R1, typename R2>
bool ratio_less_equal_v = ratio_less_equal<R1, R2>::value
inlineconstexpr

◆ ratio_less_v

template<typename R1, typename R2>
bool ratio_less_v = ratio_less<R1, R2>::value
inlineconstexpr

◆ ratio_not_equal_v

template<typename R1, typename R2>
bool ratio_not_equal_v = ratio_not_equal<R1, R2>::value
inlineconstexpr