CNL  2.0.2 (development)
Compositional Numeric Library
cnl::fraction< Numerator, Denominator > Struct Template Reference

numeric type represented as the fraction, numerator / denominator More...

#include <definition.h>

Public Types

using denominator_type = Denominator
 alias to Denominator
 
using numerator_type = Numerator
 alias to Numerator
 

Public Member Functions

template<std::floating_point Scalar>
constexpr operator Scalar () const
 returns the quotient, numerator / denominator
 

Public Attributes

denominator_type denominator = 1
 the denominator (bottom number) of the fraction
 
numerator_type numerator
 the numerator (top number) of the fraction
 

Detailed Description

template<fixed_point Numerator = int, fixed_point Denominator = Numerator>
struct cnl::fraction< Numerator, Denominator >

numeric type represented as the fraction, numerator / denominator

Template Parameters
Numeratorthe type of numerator
Exponentthe type of denominator