WPILibC++ 2023.4.3
math.h File Reference
#include <cmath>
#include "units/angle.h"
#include "units/base.h"
#include "units/dimensionless.h"

Go to the source code of this file.

Namespaces

namespace  units
 Unit Conversion Library namespace.
 
namespace  units::math
 namespace for unit-enabled versions of the <cmath> library
 

Functions

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