Namespace for all classes, typedefs and functions of dimensional analyse. See Dimensional Analysis for more instrucion.
More...
|
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...
|
|
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.
◆ 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
-
value | Decimal which fraction will generate from. |
n | Max 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
.