Cpp Utilities 1.2.3
Classes | Functions
Dimensional Namespace Reference

Namespace for all classes, typedefs and functions of dimensional analyse. See Dimensional Analysis for more instrucion. More...

Classes

class  Quantity
 The Quantity struct is used to describe arithmetic values with units. More...
 
struct  Unit
 The Unit struct is used to describe physical units. More...
 

Functions

template<typename NewRatio , typename T , typename U , typename Ratio >
Quantity< T, U, NewRatio > quantity_cast (Quantity< T, U, Ratio > x)
 
std::pair< intmax_t, intmax_t > approximateRatio (long double value, int n)
 Calculate approximate fraction from input decimal. More...
 

Detailed Description

Namespace for all classes, typedefs and functions of dimensional analyse. See Dimensional Analysis for more instrucion.

Warning
using namespace is not recommend, because some classes and typedefs will duplicate with existing symbols. Consider using keyword with specific symbol like using Dimensional::Quantity instead.

Function Documentation

◆ quantity_cast()

template<typename NewRatio , typename T , typename U , typename Ratio >
Quantity< T, U, NewRatio > Dimensional::quantity_cast ( Quantity< T, U, Ratio >  x)
related

◆ approximateRatio()

std::pair< intmax_t, intmax_t > Dimensional::approximateRatio ( long double  value,
int  n 
)
inline

Calculate approximate fraction from input decimal.

#include <Ratios.hpp>

Parameters
valueDecimal which fraction will generate from.
nMax calculate precision. Not the bigger the better, too big value wiil caouse integer overflow, and some small value may product fraction with higher precision.
Returns
Numerator and denominator of the fraction with type intmax_t.