1#ifndef PHYTH_QUANTITY_FUNCS_HPP
2#define PHYTH_QUANTITY_FUNCS_HPP
18 return {std::sin(
q.value)};
28 return {std::cos(
q.value)};
38 return {std::tan(
q.value)};
48 return {std::asin(
q.value)};
58 return {std::acos(
q.value)};
68 return {std::atan(
q.value)};
89 return {std::sinh(
q.value)};
99 return {std::cosh(
q.value)};
109 return {std::tanh(
q.value)};
119 return {std::asinh(
q.value)};
129 return {std::acosh(
q.value)};
139 return {std::atanh(
q.value)};
149 return {std::log(
q.value)};
159 return {std::log10(
q.value)};
169 return {std::log2(
q.value)};
179 return {std::log1p(
q.value)};
189 return {std::exp(
q.value)};
199 return {std::expm1(
q.value)};
209 return {std::exp2(
q.value)};
227 template<
int Power,
typename UnitT>
233 using DimT =
typename UnitT::DimensionT;
238 using DimT =
typename UnitT::DimensionT;
255 template<
typename UnitT>
257 using DimT =
typename UnitT::DimensionT;
270 template<
typename UnitT>
272 using DimT =
typename UnitT::DimensionT;
290 template<
int N,
typename UnitT>
292 static_assert(
N > 0,
"Root index must be positive");
293 using DimT =
typename UnitT::DimensionT;
309 template<
typename UnitT>
320 template<
typename UnitT>
331 template<
typename UnitT>
343 template<
typename UnitT>
360 template<
typename UnitT>
372 template<
typename UnitT>
385 template<
typename UnitT>
399 template<
typename UnitT>
411 template<
typename UnitT>
422 template<
typename UnitT>
424 return std::isnan(x.
value);
433 template<
typename UnitT>
435 return std::isfinite(x.
value);
Scalar cos(const Scalar q)
Cosine of a dimensionless quantity.
bool isnan(Quantity< UnitT > x)
Determine whether a quantity is nan.
auto cbrt(Quantity< UnitT > q)
Cube root of a quantity.
Scalar atan2(const Scalar y, const Scalar x)
Two-argument arc tangent (atan2)
Scalar log2(const Scalar q)
Base-2 logarithm.
auto square(Quantity< UnitT > q)
Square of a quantity.
auto sqrt(Quantity< UnitT > q)
Square root of a quantity.
Scalar log(const Scalar q)
Natural logarithm (base e)
Quantity< UnitT > fmod(Quantity< UnitT > x, Quantity< UnitT > y)
Floating-point remainder of x / y.
auto cube(Quantity< UnitT > q)
Cube of a quantity.
Scalar log10(const Scalar q)
Base-10 logarithm.
Scalar exp(const Scalar q)
Exponential (e^q)
Scalar tanh(const Scalar q)
Hyperbolic tangent.
Quantity< UnitT > max(Quantity< UnitT > x, Quantity< UnitT > y)
Maximum of two quantities.
auto root(Quantity< UnitT > q)
N-th root of a quantity.
Scalar atanh(const Scalar q)
Inverse hyperbolic tangent.
auto abs(Quantity< UnitT > q)
Absolute value of a quantity.
Scalar asin(const Scalar q)
Arc sine (inverse sine)
Scalar atan(const Scalar q)
Arc tangent (inverse tangent)
Quantity< UnitT > min(Quantity< UnitT > x, Quantity< UnitT > y)
Minimum of two quantities.
Quantity< UnitT > floor(Quantity< UnitT > x)
Floor of a quantity (largest integer <= x)
Scalar asinh(const Scalar q)
Inverse hyperbolic sine.
Scalar tan(const Scalar q)
Tangent of a dimensionless quantity.
Quantity< UnitT > modf(Quantity< UnitT > x, Quantity< UnitT > &y)
Decompose into integer and fractional parts.
Quantity< UnitT > clamp(Quantity< UnitT > x, Quantity< UnitT > min, Quantity< UnitT > max)
Clamp a quantity between min and max bounds.
Scalar acos(const Scalar q)
Arc cosine (inverse cosine)
Scalar acosh(const Scalar q)
Inverse hyperbolic cosine.
Scalar exp2(const Scalar q)
Base-2 exponential (2^q)
auto pow(Quantity< UnitT > q)
Raise a quantity to an integer power.
Scalar cosh(const Scalar q)
Hyperbolic cosine.
Scalar expm1(const Scalar q)
exp(q) - 1 with higher precision for small q
Scalar sinh(const Scalar q)
Hyperbolic sine.
bool isfinite(Quantity< UnitT > x)
Determine whether a quantity is finite.
Scalar log1p(const Scalar q)
log(1 + q) with higher precision for small q
Scalar sin(const Scalar q)
Sine of a dimensionless quantity.
typename DimPowerType< Power, D >::type DimPowerTypeT
Convenience alias for DimPowerType.
DimDivT< Energy, Time > Power
Quantity< ScalarUnit > Scalar
typename DimRcp< D >::type DimRcpT
Convenience alias for DimRcp.
typename DimMul< D1, D2 >::type DimMulT
Convenience alias for DimMul.
typename DimRoot< N, D >::type DimRootT
Convenience alias for DimRoot.
Physical unit with dimension and scale factor relative to SI base.