16template <
typename MassDim,
typename LengthDim,
typename TimeDim,
typename AngleDim>
22 explicit constexpr RQuantity(
double val) : value(val) {
25 explicit constexpr RQuantity(
long double val) : value(static_cast<double>(val)) {
55 return value / rhs.value;
68 std::ratio_divide<LengthDim, std::ratio<2>>,
69 std::ratio_divide<TimeDim, std::ratio<2>>,
70 std::ratio_divide<AngleDim, std::ratio<2>>>
73 std::ratio_divide<LengthDim, std::ratio<2>>,
74 std::ratio_divide<TimeDim, std::ratio<2>>,
75 std::ratio_divide<AngleDim, std::ratio<2>>>(std::sqrt(value));
84#define QUANTITY_TYPE(_Mdim, _Ldim, _Tdim, _Adim, name) \
85 typedef RQuantity<std::ratio<_Mdim>, std::ratio<_Ldim>, std::ratio<_Tdim>, std::ratio<_Adim>> \
94template <typename M, typename L, typename T, typename
A>
99template <
typename M,
typename L,
typename T,
typename A>
104template <
typename M1,
112constexpr RQuantity<std::ratio_add<M1, M2>,
113 std::ratio_add<L1, L2>,
114 std::ratio_add<T1, T2>,
115 std::ratio_add<A1, A2>>
118 std::ratio_add<L1, L2>,
119 std::ratio_add<T1, T2>,
122template <
typename M,
typename L,
typename T,
typename A>
126template <
typename M,
typename L,
typename T,
typename A>
130template <
typename M1,
138constexpr RQuantity<std::ratio_subtract<M1, M2>,
139 std::ratio_subtract<L1, L2>,
140 std::ratio_subtract<T1, T2>,
141 std::ratio_subtract<A1, A2>>
144 std::ratio_subtract<L1, L2>,
145 std::ratio_subtract<T1, T2>,
148template <
typename M,
typename L,
typename T,
typename A>
149constexpr RQuantity<std::ratio_subtract<std::ratio<0>, M>,
150 std::ratio_subtract<std::ratio<0>, L>,
151 std::ratio_subtract<std::ratio<0>, T>,
152 std::ratio_subtract<std::ratio<0>,
A>>
155 std::ratio_subtract<std::ratio<0>, L>,
156 std::ratio_subtract<std::ratio<0>, T>,
157 std::ratio_subtract<std::ratio<0>,
A>>(
x / rhs.
getValue());
159template <
typename M,
typename L,
typename T,
typename A>
166template <
typename M,
typename L,
typename T,
typename A>
170template <
typename M,
typename L,
typename T,
typename A>
174template <
typename M,
typename L,
typename T,
typename A>
178template <
typename M,
typename L,
typename T,
typename A>
182template <
typename M,
typename L,
typename T,
typename A>
186template <
typename M,
typename L,
typename T,
typename A>
194template <
typename M,
typename L,
typename T,
typename A>
199template <
typename R,
typename M,
typename L,
typename T,
typename A>
200constexpr RQuantity<std::ratio_multiply<M, R>,
201 std::ratio_multiply<L, R>,
202 std::ratio_multiply<T, R>,
203 std::ratio_multiply<A, R>>
206 std::ratio_multiply<L, R>,
207 std::ratio_multiply<T, R>,
208 std::ratio_multiply<A, R>>(std::pow(lhs.
getValue(),
double(R::num) / R::den));
211template <
int R,
typename M,
typename L,
typename T,
typename A>
212constexpr RQuantity<std::ratio_multiply<M, std::ratio<R>>,
213 std::ratio_multiply<L, std::ratio<R>>,
214 std::ratio_multiply<T, std::ratio<R>>,
215 std::ratio_multiply<A, std::ratio<R>>>
218 std::ratio_multiply<L, std::ratio<R>>,
219 std::ratio_multiply<T, std::ratio<R>>,
220 std::ratio_multiply<A, std::ratio<R>>>(std::pow(lhs.
getValue(), R));
223template <
int R,
typename M,
typename L,
typename T,
typename A>
224constexpr RQuantity<std::ratio_divide<M, std::ratio<R>>,
225 std::ratio_divide<L, std::ratio<R>>,
226 std::ratio_divide<T, std::ratio<R>>,
227 std::ratio_divide<A, std::ratio<R>>>
230 std::ratio_divide<L, std::ratio<R>>,
231 std::ratio_divide<T, std::ratio<R>>,
232 std::ratio_divide<A, std::ratio<R>>>(std::pow(lhs.
getValue(), 1.0 / R));
235template <
typename M,
typename L,
typename T,
typename A>
236constexpr RQuantity<std::ratio_divide<M, std::ratio<2>>,
237 std::ratio_divide<L, std::ratio<2>>,
238 std::ratio_divide<T, std::ratio<2>>,
239 std::ratio_divide<A, std::ratio<2>>>
242 std::ratio_divide<L, std::ratio<2>>,
243 std::ratio_divide<T, std::ratio<2>>,
244 std::ratio_divide<A, std::ratio<2>>>(std::sqrt(rhs.
getValue()));
247template <
typename M,
typename L,
typename T,
typename A>
248constexpr RQuantity<std::ratio_divide<M, std::ratio<3>>,
249 std::ratio_divide<L, std::ratio<3>>,
250 std::ratio_divide<T, std::ratio<3>>,
251 std::ratio_divide<A, std::ratio<3>>>
254 std::ratio_divide<L, std::ratio<3>>,
255 std::ratio_divide<T, std::ratio<3>>,
256 std::ratio_divide<A, std::ratio<3>>>(std::cbrt(rhs.
getValue()));
259template <
typename M,
typename L,
typename T,
typename A>
260constexpr RQuantity<std::ratio_multiply<M, std::ratio<2>>,
261 std::ratio_multiply<L, std::ratio<2>>,
262 std::ratio_multiply<T, std::ratio<2>>,
263 std::ratio_multiply<A, std::ratio<2>>>
266 std::ratio_multiply<L, std::ratio<2>>,
267 std::ratio_multiply<T, std::ratio<2>>,
268 std::ratio_multiply<A, std::ratio<2>>>(std::pow(rhs.
getValue(), 2));
271template <
typename M,
typename L,
typename T,
typename A>
272constexpr RQuantity<std::ratio_multiply<M, std::ratio<3>>,
273 std::ratio_multiply<L, std::ratio<3>>,
274 std::ratio_multiply<T, std::ratio<3>>,
275 std::ratio_multiply<A, std::ratio<3>>>
278 std::ratio_multiply<L, std::ratio<3>>,
279 std::ratio_multiply<T, std::ratio<3>>,
280 std::ratio_multiply<A, std::ratio<3>>>(std::pow(rhs.
getValue(), 3));
283template <
typename M,
typename L,
typename T,
typename A>
289template <
typename M,
typename L,
typename T,
typename A>
295template <
typename M1,
308template <
typename M,
typename L,
typename T,
typename A>
314template <
typename M,
typename L,
typename T,
typename A>
320template <
typename M,
typename L,
typename T,
typename A>
326template <
typename M,
typename L,
typename T,
typename A>
336sin(
const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> &rhs) {
337 return Number(std::sin(rhs.getValue()));
341cos(
const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> &rhs) {
342 return Number(std::cos(rhs.getValue()));
346tan(
const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> &rhs) {
347 return Number(std::tan(rhs.getValue()));
350constexpr RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>
353 std::asin(rhs.getValue()));
356constexpr RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>
359 std::acos(rhs.getValue()));
362constexpr RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>
365 std::atan(rhs.getValue()));
369sinh(
const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> &rhs) {
370 return Number(std::sinh(rhs.getValue()));
374cosh(
const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> &rhs) {
375 return Number(std::cosh(rhs.getValue()));
379tanh(
const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> &rhs) {
380 return Number(std::tanh(rhs.getValue()));
383constexpr RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>
386 std::asinh(rhs.getValue()));
389constexpr RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>
392 std::acosh(rhs.getValue()));
395constexpr RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>
398 std::atanh(rhs.getValue()));
401template <
typename M,
typename L,
typename T,
typename A>
402constexpr RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>
408inline namespace literals {
409constexpr long double operator"" _pi(
long double x) {
410 return static_cast<double>(
x) * 3.1415926535897932384626433832795;
412constexpr long double operator"" _pi(
unsigned long long int x) {
413 return static_cast<double>(
x) * 3.1415926535897932384626433832795;
419#define ConvertTo(_x, _y) (_x).convert(1.0_##_y)
#define QUANTITY_TYPE(_Mdim, _Ldim, _Tdim, _Adim, name)
constexpr RQuantity const & operator+=(const RQuantity &rhs)
constexpr RQuantity< MassDim, LengthDim, TimeDim, AngleDim > abs() const
constexpr RQuantity operator-()
constexpr RQuantity const & operator*=(const double rhs)
constexpr RQuantity< std::ratio_divide< MassDim, std::ratio< 2 > >, std::ratio_divide< LengthDim, std::ratio< 2 > >, std::ratio_divide< TimeDim, std::ratio< 2 > >, std::ratio_divide< AngleDim, std::ratio< 2 > > > sqrt() const
constexpr RQuantity(double val)
constexpr double convert(const RQuantity &rhs) const
constexpr RQuantity const & operator-=(const RQuantity &rhs)
constexpr double getValue() const
constexpr RQuantity(long double val)
constexpr RQuantity const & operator/=(const double rhs)
constexpr RQuantity< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 > > acosh(const Number &rhs)
constexpr RQuantity< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 > > atan(const Number &rhs)
constexpr Number number(1.0)
constexpr bool operator!=(const RQuantity< M, L, T, A > &lhs, const RQuantity< M, L, T, A > &rhs)
constexpr RQuantity< std::ratio_multiply< M, std::ratio< 3 > >, std::ratio_multiply< L, std::ratio< 3 > >, std::ratio_multiply< T, std::ratio< 3 > >, std::ratio_multiply< A, std::ratio< 3 > > > cube(const RQuantity< M, L, T, A > &rhs)
constexpr RQuantity< std::ratio_divide< M, std::ratio< 3 > >, std::ratio_divide< L, std::ratio< 3 > >, std::ratio_divide< T, std::ratio< 3 > >, std::ratio_divide< A, std::ratio< 3 > > > cbrt(const RQuantity< M, L, T, A > &rhs)
constexpr RQuantity< std::ratio_subtract< M1, M2 >, std::ratio_subtract< L1, L2 >, std::ratio_subtract< T1, T2 >, std::ratio_subtract< A1, A2 > > operator/(const RQuantity< M1, L1, T1, A1 > &lhs, const RQuantity< M2, L2, T2, A2 > &rhs)
constexpr RQuantity< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 > > asinh(const Number &rhs)
constexpr RQuantity< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 > > acos(const Number &rhs)
constexpr Number tanh(const RQuantity< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 > > &rhs)
constexpr bool operator==(const RQuantity< M, L, T, A > &lhs, const RQuantity< M, L, T, A > &rhs)
constexpr Number cos(const RQuantity< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 > > &rhs)
constexpr RQuantity< M, L, T, A > round(const RQuantity< M, L, T, A > &lhs, const RQuantity< M, L, T, A > &rhs)
AbstractMotor::GearsetRatioPair operator*(AbstractMotor::gearset gearset, double ratio)
constexpr RQuantity< M, L, T, A > abs(const RQuantity< M, L, T, A > &rhs)
constexpr RQuantity< std::ratio_divide< M, std::ratio< 2 > >, std::ratio_divide< L, std::ratio< 2 > >, std::ratio_divide< T, std::ratio< 2 > >, std::ratio_divide< A, std::ratio< 2 > > > sqrt(const RQuantity< M, L, T, A > &rhs)
constexpr bool operator>(const RQuantity< M, L, T, A > &lhs, const RQuantity< M, L, T, A > &rhs)
constexpr RQuantity< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 > > atanh(const Number &rhs)
constexpr RQuantity< M, L, T, A > hypot(const RQuantity< M, L, T, A > &lhs, const RQuantity< M, L, T, A > &rhs)
constexpr RQuantity< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 > > asin(const Number &rhs)
constexpr RQuantity< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 > > atan2(const RQuantity< M, L, T, A > &lhs, const RQuantity< M, L, T, A > &rhs)
constexpr RQuantity< M, L, T, A > operator-(const RQuantity< M, L, T, A > &lhs, const RQuantity< M, L, T, A > &rhs)
constexpr RQuantity< std::ratio_multiply< M, R >, std::ratio_multiply< L, R >, std::ratio_multiply< T, R >, std::ratio_multiply< A, R > > pow(const RQuantity< M, L, T, A > &lhs)
constexpr Number sin(const RQuantity< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 > > &rhs)
constexpr Number sinh(const RQuantity< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 > > &rhs)
constexpr RQuantity< M, L, T, A > ceil(const RQuantity< M, L, T, A > &lhs, const RQuantity< M, L, T, A > &rhs)
constexpr bool operator<(const RQuantity< M, L, T, A > &lhs, const RQuantity< M, L, T, A > &rhs)
constexpr RQuantity< std::ratio_multiply< M, std::ratio< 2 > >, std::ratio_multiply< L, std::ratio< 2 > >, std::ratio_multiply< T, std::ratio< 2 > >, std::ratio_multiply< A, std::ratio< 2 > > > square(const RQuantity< M, L, T, A > &rhs)
constexpr RQuantity< std::ratio_divide< M, std::ratio< R > >, std::ratio_divide< L, std::ratio< R > >, std::ratio_divide< T, std::ratio< R > >, std::ratio_divide< A, std::ratio< R > > > root(const RQuantity< M, L, T, A > &lhs)
constexpr Number cosh(const RQuantity< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 > > &rhs)
constexpr bool operator>=(const RQuantity< M, L, T, A > &lhs, const RQuantity< M, L, T, A > &rhs)
constexpr bool operator<=(const RQuantity< M, L, T, A > &lhs, const RQuantity< M, L, T, A > &rhs)
constexpr Number tan(const RQuantity< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 > > &rhs)
constexpr RQuantity< M, L, T, A > trunc(const RQuantity< M, L, T, A > &lhs, const RQuantity< M, L, T, A > &rhs)
constexpr RQuantity< M, L, T, A > floor(const RQuantity< M, L, T, A > &lhs, const RQuantity< M, L, T, A > &rhs)
constexpr RQuantity< M1, L1, T1, A1 > copysign(const RQuantity< M1, L1, T1, A1 > &lhs, const RQuantity< M2, L2, T2, A2 > &rhs)
constexpr RQuantity< M, L, T, A > mod(const RQuantity< M, L, T, A > &lhs, const RQuantity< M, L, T, A > &rhs)