units_math(3)

units::math(3) Unit Conversion and Dimensional Analysis Library units::math(3)

NAME

units::math - namespace for unit-enabled versions of the <cmath> library

SYNOPSIS

Functions


template<int power, class UnitType , class = typename std::enable_if<traits::has_linear_scale<UnitType>::value, int>> auto pow (const UnitType &value) noexcept -> unit_t< typename units::detail::power_of_unit< power, typename units::traits::unit_t_traits< UnitType >::unit_type >::type, typename units::traits::unit_t_traits< UnitType >::underlying_type, linear_scale >
computes the value of value raised to the power template<int power, class UnitType , class = typename std::enable_if<traits::has_linear_scale<UnitType>::value, int>> constexpr auto cpow (const UnitType &value) noexcept -> unit_t< typename units::detail::power_of_unit< power, typename units::traits::unit_t_traits< UnitType >::unit_type >::type, typename units::traits::unit_t_traits< UnitType >::underlying_type, linear_scale >
computes the value of value raised to the power as a constexpr template<class UnitTypeLhs , class UnitTypeRhs > UnitTypeLhs min (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs)
template<class UnitTypeLhs , class UnitTypeRhs > UnitTypeLhs max (const UnitTypeLhs &lhs, const UnitTypeRhs &rhs)
template<class AngleUnit > dimensionless::scalar_t cos (const AngleUnit angle) noexcept
Compute cosine. template<class AngleUnit > dimensionless::scalar_t sin (const AngleUnit angle) noexcept
Compute sine. template<class AngleUnit > dimensionless::scalar_t tan (const AngleUnit angle) noexcept
Compute tangent. template<class ScalarUnit > angle::radian_t acos (const ScalarUnit x) noexcept
Compute arc cosine. template<class ScalarUnit > angle::radian_t asin (const ScalarUnit x) noexcept
Compute arc sine. template<class ScalarUnit > angle::radian_t atan (const ScalarUnit x) noexcept
Compute arc tangent. template<class Y , class X > angle::radian_t atan2 (const Y y, const X x) noexcept
Compute arc tangent with two parameters. template<class AngleUnit > dimensionless::scalar_t cosh (const AngleUnit angle) noexcept
Compute hyperbolic cosine. template<class AngleUnit > dimensionless::scalar_t sinh (const AngleUnit angle) noexcept
Compute hyperbolic sine. template<class AngleUnit > dimensionless::scalar_t tanh (const AngleUnit angle) noexcept
Compute hyperbolic tangent. template<class ScalarUnit > angle::radian_t acosh (const ScalarUnit x) noexcept
Compute arc hyperbolic cosine. template<class ScalarUnit > angle::radian_t asinh (const ScalarUnit x) noexcept
Compute arc hyperbolic sine. template<class ScalarUnit > angle::radian_t atanh (const ScalarUnit x) noexcept
Compute arc hyperbolic tangent. template<class ScalarUnit > dimensionless::scalar_t exp (const ScalarUnit x) noexcept
Compute exponential function. template<class ScalarUnit > dimensionless::scalar_t log (const ScalarUnit x) noexcept
Compute natural logarithm. template<class ScalarUnit > dimensionless::scalar_t log10 (const ScalarUnit x) noexcept
Compute common logarithm. template<class ScalarUnit > dimensionless::scalar_t modf (const ScalarUnit x, ScalarUnit *intpart) noexcept
Break into fractional and integral parts. template<class ScalarUnit > dimensionless::scalar_t exp2 (const ScalarUnit x) noexcept
Compute binary exponential function. template<class ScalarUnit > dimensionless::scalar_t expm1 (const ScalarUnit x) noexcept
Compute exponential minus one. template<class ScalarUnit > dimensionless::scalar_t log1p (const ScalarUnit x) noexcept
Compute logarithm plus one. template<class ScalarUnit > dimensionless::scalar_t log2 (const ScalarUnit x) noexcept
Compute binary logarithm. template<class UnitType , std::enable_if_t< units::traits::has_linear_scale< UnitType >::value, int > = 0> auto sqrt (const UnitType &value) noexcept -> unit_t< square_root< typename units::traits::unit_t_traits< UnitType >::unit_type >, typename units::traits::unit_t_traits< UnitType >::underlying_type, linear_scale >
computes the square root of value template<class UnitTypeLhs , class UnitTypeRhs , std::enable_if_t< units::traits::has_linear_scale< UnitTypeLhs, UnitTypeRhs >::value, int > = 0> UnitTypeLhs hypot (const UnitTypeLhs &x, const UnitTypeRhs &y)
Computes the square root of the sum-of-squares of x and y. template<class UnitType , class = std::enable_if_t<traits::is_unit_t<UnitType>::value>> UnitType ceil (const UnitType x) noexcept
Round up value. template<class UnitType , class = std::enable_if_t<traits::is_unit_t<UnitType>::value>> UnitType floor (const UnitType x) noexcept
Round down value. template<class UnitTypeLhs , class UnitTypeRhs , class = std::enable_if_t<traits::is_unit_t<UnitTypeLhs>::value && traits::is_unit_t<UnitTypeRhs>::value>> UnitTypeLhs fmod (const UnitTypeLhs numer, const UnitTypeRhs denom) noexcept
Compute remainder of division. template<class UnitType , class = std::enable_if_t<traits::is_unit_t<UnitType>::value>> UnitType trunc (const UnitType x) noexcept
Truncate value. template<class UnitType , class = std::enable_if_t<traits::is_unit_t<UnitType>::value>> UnitType round (const UnitType x) noexcept
Round to nearest. template<class UnitTypeLhs , class UnitTypeRhs , class = std::enable_if_t<traits::is_unit_t<UnitTypeLhs>::value && traits::is_unit_t<UnitTypeRhs>::value>> UnitTypeLhs copysign (const UnitTypeLhs x, const UnitTypeRhs y) noexcept
Copy sign. template<class UnitTypeLhs , class = std::enable_if_t<traits::is_unit_t<UnitTypeLhs>::value>> UnitTypeLhs copysign (const UnitTypeLhs x, const double y) noexcept
Overload to copy the sign from a raw double. template<class UnitTypeLhs , class UnitTypeRhs , class = std::enable_if_t<traits::is_unit_t<UnitTypeLhs>::value && traits::is_unit_t<UnitTypeRhs>::value>> UnitTypeLhs fdim (const UnitTypeLhs x, const UnitTypeRhs y) noexcept
Positive difference. template<class UnitTypeLhs , class UnitTypeRhs , class = std::enable_if_t<traits::is_unit_t<UnitTypeLhs>::value && traits::is_unit_t<UnitTypeRhs>::value>> UnitTypeLhs fmax (const UnitTypeLhs x, const UnitTypeRhs y) noexcept
Maximum value. template<class UnitTypeLhs , class UnitTypeRhs , class = std::enable_if_t<traits::is_unit_t<UnitTypeLhs>::value && traits::is_unit_t<UnitTypeRhs>::value>> UnitTypeLhs fmin (const UnitTypeLhs x, const UnitTypeRhs y) noexcept
Minimum value. template<class UnitType , class = std::enable_if_t<traits::is_unit_t<UnitType>::value>> UnitType fabs (const UnitType x) noexcept
Compute absolute value. template<class UnitType , class = std::enable_if_t<traits::is_unit_t<UnitType>::value>> UnitType abs (const UnitType x) noexcept
Compute absolute value. template<class UnitTypeLhs , class UnitMultiply , class UnitAdd , class = std::enable_if_t<traits::is_unit_t<UnitTypeLhs>::value && traits::is_unit_t<UnitMultiply>::value && traits::is_unit_t<UnitAdd>::value>> auto fma (const UnitTypeLhs x, const UnitMultiply y, const UnitAdd z) noexcept -> decltype(x *y)
Multiply-add.

Detailed Description

namespace for unit-enabled versions of the <cmath> library

Includes trigonometric functions, exponential/log functions, rounding functions, etc.

See also

See unit_t for more information on unit type containers.

Function Documentation

template<int power, class UnitType , class = typename std::enable_if<traits::has_linear_scale<UnitType>::value, int>> constexpr auto units::math::cpow (const UnitType & value) -> unit_t<typename units::detail::power_of_unit<power, typename units::traits::unit_t_traits<UnitType>::unit_type>::type, typename units::traits::unit_t_traits<UnitType>::underlying_type, linear_scale>

[inline], [constexpr], [noexcept]"

computes the value of value raised to the power as a constexpr Only implemented for linear_scale units. Power must be known at compile time, so the resulting unit type can be deduced. Additionally, the power must be a positive, integral, value.

Template Parameters

power exponential power to raise value by.

Parameters

value unit_t derived type to raise to the given power

Returns

new unit_t, raised to the given exponent

template<int power, class UnitType , class = typename std::enable_if<traits::has_linear_scale<UnitType>::value, int>> auto units::math::pow (const UnitType & value) -> unit_t<typename units::detail::power_of_unit<power, typename units::traits::unit_t_traits<UnitType>::unit_type>::type, typename units::traits::unit_t_traits<UnitType>::underlying_type, linear_scale>

[inline], [noexcept]"

computes the value of value raised to the power Only implemented for linear_scale units. Power must be known at compile time, so the resulting unit type can be deduced.

Template Parameters

power exponential power to raise value by.

Parameters

value unit_t derived type to raise to the given power

Returns

new unit_t, raised to the given exponent

Author

Generated automatically by Doxygen for Unit Conversion and Dimensional Analysis Library from the source code.

Wed Mar 29 2023 Version 2.3.0