WPILibC++ 2024.3.2
|
Namespaces | |
namespace | internal |
Typedefs | |
using | uint_t = unsigned int |
using | ullint_t = unsigned long long int |
using | llint_t = long long int |
template<class T > | |
using | GCLIM = std::numeric_limits< T > |
template<typename T > | |
using | return_t = typename std::conditional< std::is_integral< T >::value, double, T >::type |
template<typename ... T> | |
using | common_t = typename std::common_type< T... >::type |
template<typename ... T> | |
using | common_return_t = return_t< common_t< T... > > |
Functions | |
template<typename T > | |
constexpr return_t< T > | acos (const T x) noexcept |
Compile-time arccosine function. More... | |
template<typename T1 , typename T2 > | |
constexpr common_t< T1, T2 > | binomial_coef (const T1 n, const T2 k) noexcept |
Compile-time binomial coefficient. More... | |
template<typename T1 , typename T2 , typename T3 > | |
constexpr common_return_t< T1, T2, T3 > | incomplete_beta (const T1 a, const T2 b, const T3 z) noexcept |
Compile-time regularized incomplete beta function. More... | |
template<typename T1 , typename T2 > | |
constexpr common_return_t< T1, T2 > | atan2 (const T1 y, const T2 x) noexcept |
Compile-time two-argument arctangent function. More... | |
template<typename T > | |
constexpr return_t< T > | expm1 (const T x) noexcept |
Compile-time exponential-minus-1 function. More... | |
template<typename T1 , typename T2 > | |
constexpr return_t< T1 > | lmgamma (const T1 a, const T2 p) noexcept |
Compile-time log multivariate gamma function. More... | |
template<typename T > | |
constexpr T | abs (const T x) noexcept |
Compile-time absolute value function. More... | |
template<typename T1 , typename T2 > | |
constexpr common_t< T1, T2 > | max (const T1 x, const T2 y) noexcept |
Compile-time pairwise maximum function. More... | |
template<typename T > | |
constexpr return_t< T > | trunc (const T x) noexcept |
Compile-time trunc function. More... | |
template<typename T1 , typename T2 > | |
constexpr common_t< T1, T2 > | lcm (const T1 a, const T2 b) noexcept |
Compile-time least common multiple (LCM) function. More... | |
template<typename T > | |
constexpr return_t< T > | erf (const T x) noexcept |
Compile-time Gaussian error function. More... | |
template<typename T > | |
constexpr return_t< T > | tanh (const T x) noexcept |
Compile-time hyperbolic tangent function. More... | |
template<typename T > | |
constexpr return_t< T > | atanh (const T x) noexcept |
Compile-time inverse hyperbolic tangent function. More... | |
template<typename T > | |
constexpr return_t< T > | inv_sqrt (const T x) noexcept |
Compile-time inverse-square-root function. More... | |
template<typename T > | |
constexpr return_t< T > | log1p (const T x) noexcept |
Compile-time natural-logarithm-plus-1 function. More... | |
template<typename T1 , typename T2 > | |
constexpr common_return_t< T1, T2 > | lbeta (const T1 a, const T2 b) noexcept |
Compile-time log-beta function. More... | |
template<typename T > | |
constexpr int | sgn (const T x) noexcept |
Compile-time sign function. More... | |
template<typename T1 , typename T2 > | |
constexpr common_return_t< T1, T2 > | log_binomial_coef (const T1 n, const T2 k) noexcept |
Compile-time log binomial coefficient. More... | |
template<typename T1 , typename T2 > | |
constexpr common_return_t< T1, T2 > | beta (const T1 a, const T2 b) noexcept |
Compile-time beta function. More... | |
template<typename T > | |
constexpr return_t< T > | round (const T x) noexcept |
Compile-time round function. More... | |
template<typename T > | |
constexpr return_t< T > | lgamma (const T x) noexcept |
Compile-time log-gamma function. More... | |
template<typename T > | |
constexpr return_t< T > | log (const T x) noexcept |
Compile-time natural logarithm function. More... | |
template<typename T1 , typename T2 > | |
constexpr common_t< T1, T2 > | pow (const T1 base, const T2 exp_term) noexcept |
Compile-time power function. More... | |
template<typename T1 , typename T2 > | |
constexpr common_t< T1, T2 > | min (const T1 x, const T2 y) noexcept |
Compile-time pairwise minimum function. More... | |
template<typename T > | |
constexpr return_t< T > | log2 (const T x) noexcept |
Compile-time binary logarithm function. More... | |
template<typename T > | |
constexpr return_t< T > | cos (const T x) noexcept |
Compile-time cosine function. More... | |
template<typename T > | |
constexpr return_t< T > | acosh (const T x) noexcept |
Compile-time inverse hyperbolic cosine function. More... | |
template<typename T > | |
constexpr bool | signbit (const T x) noexcept |
Compile-time sign bit detection function. More... | |
template<typename T > | |
constexpr return_t< T > | sinh (const T x) noexcept |
Compile-time hyperbolic sine function. More... | |
template<typename T > | |
constexpr return_t< T > | asinh (const T x) noexcept |
Compile-time inverse hyperbolic sine function. More... | |
template<typename T1 , typename T2 > | |
constexpr T1 | copysign (const T1 x, const T2 y) noexcept |
Compile-time copy sign function. More... | |
template<typename T > | |
constexpr return_t< T > | sin (const T x) noexcept |
Compile-time sine function. More... | |
template<typename T > | |
constexpr return_t< T > | atan (const T x) noexcept |
Compile-time arctangent function. More... | |
template<typename T > | |
constexpr return_t< T > | log10 (const T x) noexcept |
Compile-time common logarithm function. More... | |
template<typename T > | |
constexpr return_t< T > | tan (const T x) noexcept |
Compile-time tangent function. More... | |
template<typename T > | |
constexpr return_t< T > | exp (const T x) noexcept |
Compile-time exponential function. More... | |
template<typename T > | |
constexpr T | factorial (const T x) noexcept |
Compile-time factorial function. More... | |
template<typename T1 , typename T2 > | |
constexpr common_return_t< T1, T2 > | fmod (const T1 x, const T2 y) noexcept |
Compile-time remainder of division function. More... | |
template<typename T1 , typename T2 , typename T3 > | |
constexpr common_t< T1, T2, T3 > | incomplete_beta_inv (const T1 a, const T2 b, const T3 p) noexcept |
Compile-time inverse incomplete beta function. More... | |
template<typename T1 , typename T2 > | |
constexpr common_t< T1, T2 > | gcd (const T1 a, const T2 b) noexcept |
Compile-time greatest common divisor (GCD) function. More... | |
template<typename T > | |
constexpr return_t< T > | erf_inv (const T p) noexcept |
Compile-time inverse Gaussian error function. More... | |
template<typename T > | |
constexpr return_t< T > | sqrt (const T x) noexcept |
Compile-time square-root function. More... | |
template<typename T > | |
constexpr return_t< T > | cosh (const T x) noexcept |
Compile-time hyperbolic cosine function. More... | |
template<typename T > | |
constexpr return_t< T > | asin (const T x) noexcept |
Compile-time arcsine function. More... | |
template<typename T > | |
constexpr return_t< T > | ceil (const T x) noexcept |
Compile-time ceil function. More... | |
template<typename T1 , typename T2 > | |
constexpr common_return_t< T1, T2 > | incomplete_gamma_inv (const T1 a, const T2 p) noexcept |
Compile-time inverse incomplete gamma function. More... | |
template<typename T > | |
constexpr return_t< T > | tgamma (const T x) noexcept |
Compile-time gamma function. More... | |
template<typename T1 , typename T2 > | |
constexpr common_return_t< T1, T2 > | hypot (const T1 x, const T2 y) noexcept |
Compile-time Pythagorean addition function. More... | |
template<typename T1 , typename T2 , typename T3 > | |
constexpr common_return_t< T1, T2, T3 > | hypot (const T1 x, const T2 y, const T3 z) noexcept |
Compile-time Pythagorean addition function. More... | |
template<typename T > | |
constexpr return_t< T > | floor (const T x) noexcept |
Compile-time floor function. More... | |
template<typename T1 , typename T2 > | |
constexpr common_return_t< T1, T2 > | incomplete_gamma (const T1 a, const T2 x) noexcept |
Compile-time regularized lower incomplete gamma function. More... | |
Variables | |
static const long double | gauss_legendre_30_points [30] |
static const long double | gauss_legendre_30_weights [30] |
static const long double | gauss_legendre_50_points [50] |
static const long double | gauss_legendre_50_weights [50] |
using gcem::common_return_t = typedef return_t<common_t<T...> > |
using gcem::common_t = typedef typename std::common_type<T...>::type |
using gcem::GCLIM = typedef std::numeric_limits<T> |
using gcem::llint_t = typedef long long int |
using gcem::return_t = typedef typename std::conditional<std::is_integral<T>::value,double,T>::type |
using gcem::uint_t = typedef unsigned int |
using gcem::ullint_t = typedef unsigned long long int |
|
constexprnoexcept |
Compile-time absolute value function.
x | a real-valued input. |
x
, \( |x| \).
|
constexprnoexcept |
Compile-time arccosine function.
x | a real-valued input, where \( x \in [-1,1] \). |
\[ \text{acos}(x) = \text{atan} \left( \frac{\sqrt{1-x^2}}{x} \right) \]
|
constexprnoexcept |
Compile-time inverse hyperbolic cosine function.
x | a real-valued input. |
\[ \text{acosh}(x) = \ln \left( x + \sqrt{x^2 - 1} \right) \]
|
constexprnoexcept |
Compile-time arcsine function.
x | a real-valued input, where \( x \in [-1,1] \). |
\[ \text{asin}(x) = \text{atan} \left( \frac{x}{\sqrt{1-x^2}} \right) \]
|
constexprnoexcept |
Compile-time inverse hyperbolic sine function.
x | a real-valued input. |
\[ \text{asinh}(x) = \ln \left( x + \sqrt{x^2 + 1} \right) \]
|
constexprnoexcept |
Compile-time arctangent function.
x | a real-valued input. |
\[ \text{atan}(x) = \dfrac{x}{1 + \dfrac{x^2}{3 + \dfrac{4x^2}{5 + \dfrac{9x^2}{7 + \ddots}}}} \]
|
constexprnoexcept |
Compile-time two-argument arctangent function.
y | a real-valued input. |
x | a real-valued input. |
\[ \text{atan2}(y,x) = \begin{cases} \text{atan}(y/x) & \text{ if } x > 0 \\ \text{atan}(y/x) + \pi & \text{ if } x < 0 \text{ and } y \geq 0 \\ \text{atan}(y/x) - \pi & \text{ if } x < 0 \text{ and } y < 0 \\ + \pi/2 & \text{ if } x = 0 \text{ and } y > 0 \\ - \pi/2 & \text{ if } x = 0 \text{ and } y < 0 \end{cases} \]
The function is undefined at the origin, however the following conventions are used.\[ \text{atan2}(y,x) = \begin{cases} +0 & \text{ if } x = +0 \text{ and } y = +0 \\ -0 & \text{ if } x = +0 \text{ and } y = -0 \\ +\pi & \text{ if } x = -0 \text{ and } y = +0 \\ - \pi & \text{ if } x = -0 \text{ and } y = -0 \end{cases} \]
|
constexprnoexcept |
Compile-time inverse hyperbolic tangent function.
x | a real-valued input. |
\[ \text{atanh}(x) = \frac{1}{2} \ln \left( \frac{1+x}{1-x} \right) \]
|
constexprnoexcept |
Compile-time beta function.
a | a real-valued input. |
b | a real-valued input. |
\[ \text{B}(\alpha,\beta) := \int_0^1 t^{\alpha - 1} (1-t)^{\beta - 1} dt = \frac{\Gamma(\alpha)\Gamma(\beta)}{\Gamma(\alpha + \beta)} \]
where \( \Gamma \) denotes the gamma function.
|
constexprnoexcept |
Compile-time binomial coefficient.
n | integral-valued input. |
k | integral-valued input. |
\[ \binom{n}{k} = \frac{n!}{k!(n-k)!} \]
also known as 'n
choose k
'.
|
constexprnoexcept |
Compile-time ceil function.
x | a real-valued input. |
|
constexprnoexcept |
Compile-time copy sign function.
x | a real-valued input |
y | a real-valued input |
x
with the signbit of y
.
|
constexprnoexcept |
Compile-time cosine function.
x | a real-valued input. |
\[ \cos(x) = \frac{1-\tan^2(x/2)}{1+\tan^2(x/2)} \]
|
constexprnoexcept |
Compile-time hyperbolic cosine function.
x | a real-valued input. |
\[ \cosh(x) = \frac{\exp(x) + \exp(-x)}{2} \]
|
constexprnoexcept |
Compile-time Gaussian error function.
x | a real-valued input. |
\[ \text{erf}(x) = \frac{2}{\sqrt{\pi}} \int_0^x \exp( - t^2) dt \]
using a continued fraction representation:\[ \text{erf}(x) = \frac{2x}{\sqrt{\pi}} \exp(-x^2) \dfrac{1}{1 - 2x^2 + \dfrac{4x^2}{3 - 2x^2 + \dfrac{8x^2}{5 - 2x^2 + \dfrac{12x^2}{7 - 2x^2 + \ddots}}}} \]
|
constexprnoexcept |
Compile-time inverse Gaussian error function.
p | a real-valued input with values in the unit-interval. |
\[ f(x) := \text{erf}(x) - p \]
is equal to zero, for a givenp
. GCE-Math finds this root using Halley's method: \[ x_{n+1} = x_n - \frac{f(x_n)/f'(x_n)}{1 - 0.5 \frac{f(x_n)}{f'(x_n)} \frac{f''(x_n)}{f'(x_n)} } \]
where\[ \frac{\partial}{\partial x} \text{erf}(x) = \exp(-x^2), \ \ \frac{\partial^2}{\partial x^2} \text{erf}(x) = -2x\exp(-x^2) \]
|
constexprnoexcept |
Compile-time exponential function.
x | a real-valued input. |
\[ \exp(x) = \dfrac{1}{1-\dfrac{x}{1+x-\dfrac{\frac{1}{2}x}{1 + \frac{1}{2}x - \dfrac{\frac{1}{3}x}{1 + \frac{1}{3}x - \ddots}}}} \]
The continued fraction argument is split into two parts: \( x = n + r \), where \( n \) is an integer and \( r \in [-0.5,0.5] \).
|
constexprnoexcept |
Compile-time exponential-minus-1 function.
x | a real-valued input. |
\[ \exp(x) = \sum_{k=0}^\infty \dfrac{x^k}{k!} \]
|
constexprnoexcept |
Compile-time factorial function.
x | a real-valued input. |
x
is an integral type (int
, long int
, etc.), a simple recursion method is used, along with table values. When x
is real-valued, factorial(x) = tgamma(x+1)
.
|
constexprnoexcept |
Compile-time floor function.
x | a real-valued input. |
|
constexprnoexcept |
Compile-time remainder of division function.
x | a real-valued input. |
y | a real-valued input. |
\[ \text{fmod}(x,y) = x - \text{trunc}(x/y) \times y \]
|
constexprnoexcept |
Compile-time greatest common divisor (GCD) function.
a | integral-valued input. |
b | integral-valued input. |
a
and b
using a Euclidean algorithm.
|
constexprnoexcept |
Compile-time Pythagorean addition function.
x | a real-valued input. |
y | a real-valued input. |
|
constexprnoexcept |
Compile-time Pythagorean addition function.
x | a real-valued input. |
y | a real-valued input. |
z | a real-valued input. |
|
constexprnoexcept |
Compile-time regularized incomplete beta function.
a | a real-valued, non-negative input. |
b | a real-valued, non-negative input. |
z | a real-valued, non-negative input. |
\[ \frac{\text{B}(z;\alpha,\beta)}{\text{B}(\alpha,\beta)} = \frac{1}{\text{B}(\alpha,\beta)}\int_0^z t^{a-1} (1-t)^{\beta-1} dt \]
using a continued fraction representation, found in the Handbook of Continued Fractions for Special Functions, and a modified Lentz method.\[ \frac{\text{B}(z;\alpha,\beta)}{\text{B}(\alpha,\beta)} = \frac{z^{\alpha} (1-t)^{\beta}}{\alpha \text{B}(\alpha,\beta)} \dfrac{a_1}{1 + \dfrac{a_2}{1 + \dfrac{a_3}{1 + \dfrac{a_4}{1 + \ddots}}}} \]
where \( a_1 = 1 \) and\[ a_{2m+2} = - \frac{(\alpha + m)(\alpha + \beta + m)}{(\alpha + 2m)(\alpha + 2m + 1)}, \ m \geq 0 \]
\[ a_{2m+1} = \frac{m(\beta - m)}{(\alpha + 2m - 1)(\alpha + 2m)}, \ m \geq 1 \]
The Lentz method works as follows: let \( f_j \) denote the value of the continued fraction up to the first \( j \) terms; \( f_j \) is updated as follows:\[ c_j = 1 + a_j / c_{j-1}, \ \ d_j = 1 / (1 + a_j d_{j-1}) \]
\[ f_j = c_j d_j f_{j-1} \]
|
constexprnoexcept |
Compile-time inverse incomplete beta function.
a | a real-valued, non-negative input. |
b | a real-valued, non-negative input. |
p | a real-valued input with values in the unit-interval. |
\[ f(x) := \frac{\text{B}(x;\alpha,\beta)}{\text{B}(\alpha,\beta)} - p \]
equal to zero, for a givenp
. GCE-Math finds this root using Halley's method: \[ x_{n+1} = x_n - \frac{f(x_n)/f'(x_n)}{1 - 0.5 \frac{f(x_n)}{f'(x_n)} \frac{f''(x_n)}{f'(x_n)} } \]
where\[ \frac{\partial}{\partial x} \left(\frac{\text{B}(x;\alpha,\beta)}{\text{B}(\alpha,\beta)}\right) = \frac{1}{\text{B}(\alpha,\beta)} x^{\alpha-1} (1-x)^{\beta-1} \]
\[ \frac{\partial^2}{\partial x^2} \left(\frac{\text{B}(x;\alpha,\beta)}{\text{B}(\alpha,\beta)}\right) = \frac{1}{\text{B}(\alpha,\beta)} x^{\alpha-1} (1-x)^{\beta-1} \left( \frac{\alpha-1}{x} - \frac{\beta-1}{1 - x} \right) \]
|
constexprnoexcept |
Compile-time regularized lower incomplete gamma function.
a | a real-valued, non-negative input. |
x | a real-valued, non-negative input. |
a
, x
), \[ \frac{\gamma(a,x)}{\Gamma(a)} = \frac{1}{\Gamma(a)} \int_0^x t^{a-1} \exp(-t) dt \]
Whena
is not too large, the value is computed using the continued fraction representation of the upper incomplete gamma function, \( \Gamma(a,x) \), using \[ \Gamma(a,x) = \Gamma(a) - \dfrac{x^a\exp(-x)}{a - \dfrac{ax}{a + 1 + \dfrac{x}{a + 2 - \dfrac{(a+1)x}{a + 3 + \dfrac{2x}{a + 4 - \ddots}}}}} \]
where \( \gamma(a,x) \) and \( \Gamma(a,x) \) are connected via\[ \frac{\gamma(a,x)}{\Gamma(a)} + \frac{\Gamma(a,x)}{\Gamma(a)} = 1 \]
When \( a > 10 \), a 50-point Gauss-Legendre quadrature scheme is employed.
|
constexprnoexcept |
Compile-time inverse incomplete gamma function.
a | a real-valued, non-negative input. |
p | a real-valued input with values in the unit-interval. |
\[ f(x) := \frac{\gamma(a,x)}{\Gamma(a)} - p \]
equal to zero, for a givenp
. GCE-Math finds this root using Halley's method: \[ x_{n+1} = x_n - \frac{f(x_n)/f'(x_n)}{1 - 0.5 \frac{f(x_n)}{f'(x_n)} \frac{f''(x_n)}{f'(x_n)} } \]
where\[ \frac{\partial}{\partial x} \left(\frac{\gamma(a,x)}{\Gamma(a)}\right) = \frac{1}{\Gamma(a)} x^{a-1} \exp(-x) \]
\[ \frac{\partial^2}{\partial x^2} \left(\frac{\gamma(a,x)}{\Gamma(a)}\right) = \frac{1}{\Gamma(a)} x^{a-1} \exp(-x) \left( \frac{a-1}{x} - 1 \right) \]
|
constexprnoexcept |
Compile-time inverse-square-root function.
x | a real-valued input. |
|
constexprnoexcept |
Compile-time log-beta function.
a | a real-valued input. |
b | a real-valued input. |
\[ \ln \text{B}(\alpha,\beta) := \ln \int_0^1 t^{\alpha - 1} (1-t)^{\beta - 1} dt = \ln \Gamma(\alpha) + \ln \Gamma(\beta) - \ln \Gamma(\alpha + \beta) \]
where \( \Gamma \) denotes the gamma function.
|
constexprnoexcept |
Compile-time least common multiple (LCM) function.
a | integral-valued input. |
b | integral-valued input. |
a
and b
using the representation \[ \text{lcm}(a,b) = \dfrac{| a b |}{\text{gcd}(a,b)} \]
where \( \text{gcd}(a,b) \) denotes the greatest common divisor between \( a \) and \( b \).
|
constexprnoexcept |
Compile-time log-gamma function.
x | a real-valued input. |
\[ \ln \Gamma(x) = \ln \int_0^\infty y^{x-1} \exp(-y) dy \]
using a polynomial form:\[ \Gamma(x+1) \approx (x+g+0.5)^{x+0.5} \exp(-x-g-0.5) \sqrt{2 \pi} \left[ c_0 + \frac{c_1}{x+1} + \frac{c_2}{x+2} + \cdots + \frac{c_n}{x+n} \right] \]
where the value \( g \) and the coefficients \( (c_0, c_1, \ldots, c_n) \) are taken from Paul Godfrey, whose note can be found here: http://my.fit.edu/~gabdo/gamma.txt
|
constexprnoexcept |
Compile-time log multivariate gamma function.
a | a real-valued input. |
p | integral-valued input. |
\[ \Gamma_p(a) = \pi^{(p-1)/2} \Gamma(a) \Gamma_{p-1}(a-0.5) \]
where \( \Gamma_1(a) = \Gamma(a) \).
|
constexprnoexcept |
Compile-time natural logarithm function.
x | a real-valued input. |
\[ \log\left(\frac{1+x}{1-x}\right) = \dfrac{2x}{1-\dfrac{x^2}{3-\dfrac{4x^2}{5 - \dfrac{9x^3}{7 - \ddots}}}}, \ \ x \in [-1,1] \]
The continued fraction argument is split into two parts: \( x = a \times 10^c \), where \( c \) is an integer.
|
constexprnoexcept |
Compile-time common logarithm function.
x | a real-valued input. |
\[ \log_{10}(x) = \frac{\log_e(x)}{\log_e(10)} \]
|
constexprnoexcept |
Compile-time natural-logarithm-plus-1 function.
x | a real-valued input. |
\[ \log(x+1) = \sum_{k=1}^\infty \dfrac{(-1)^{k-1}x^k}{k}, \ \ |x| < 1 \]
|
constexprnoexcept |
Compile-time binary logarithm function.
x | a real-valued input. |
\[ \log_{2}(x) = \frac{\log_e(x)}{\log_e(2)} \]
|
constexprnoexcept |
Compile-time log binomial coefficient.
n | integral-valued input. |
k | integral-valued input. |
\[ \ln \frac{n!}{k!(n-k)!} = \ln \Gamma(n+1) - [ \ln \Gamma(k+1) + \ln \Gamma(n-k+1) ] \]
|
constexprnoexcept |
Compile-time pairwise maximum function.
x | a real-valued input. |
y | a real-valued input. |
x
and y
, where x
and y
have the same type (e.g., int
, double
, etc.)
|
constexprnoexcept |
Compile-time pairwise minimum function.
x | a real-valued input. |
y | a real-valued input. |
x
and y
, where x
and y
have the same type (e.g., int
, double
, etc.)
|
constexprnoexcept |
Compile-time power function.
base | a real-valued input. |
exp_term | a real-valued input. |
base
raised to the power exp_term
. In the case where exp_term
is integral-valued, recursion by squaring is used, otherwise \( \text{base}^{\text{exp\_term}} = e^{\text{exp\_term} \log(\text{base})} \)
|
constexprnoexcept |
Compile-time round function.
x | a real-valued input. |
|
constexprnoexcept |
Compile-time sign function.
x | a real-valued input |
\[ y = \begin{cases} 1 \ &\text{ if } x > 0 \\ 0 \ &\text{ if } x = 0 \\ -1 \ &\text{ if } x < 0 \end{cases} \]
|
constexprnoexcept |
Compile-time sign bit detection function.
x | a real-valued input |
x
is negative, otherwise return false.
|
constexprnoexcept |
Compile-time sine function.
x | a real-valued input. |
\[ \sin(x) = \frac{2\tan(x/2)}{1+\tan^2(x/2)} \]
|
constexprnoexcept |
Compile-time hyperbolic sine function.
x | a real-valued input. |
\[ \sinh(x) = \frac{\exp(x) - \exp(-x)}{2} \]
|
constexprnoexcept |
Compile-time square-root function.
x | a real-valued input. |
|
constexprnoexcept |
Compile-time tangent function.
x | a real-valued input. |
\[ \tan(x) = \dfrac{x}{1 - \dfrac{x^2}{3 - \dfrac{x^2}{5 - \ddots}}} \]
To deal with a singularity at \( \pi / 2 \), the following expansion is employed:\[ \tan(x) = - \frac{1}{x-\pi/2} - \sum_{k=1}^\infty \frac{(-1)^k 2^{2k} B_{2k}}{(2k)!} (x - \pi/2)^{2k - 1} \]
where \( B_n \) is the n-th Bernoulli number.
|
constexprnoexcept |
Compile-time hyperbolic tangent function.
x | a real-valued input. |
\[ \tanh(x) = \dfrac{x}{1 + \dfrac{x^2}{3 + \dfrac{x^2}{5 + \dfrac{x^2}{7 + \ddots}}}} \]
|
constexprnoexcept |
Compile-time gamma function.
x | a real-valued input. |
\[ \Gamma(x) = \int_0^\infty y^{x-1} \exp(-y) dy \]
using a polynomial form:\[ \Gamma(x+1) \approx (x+g+0.5)^{x+0.5} \exp(-x-g-0.5) \sqrt{2 \pi} \left[ c_0 + \frac{c_1}{x+1} + \frac{c_2}{x+2} + \cdots + \frac{c_n}{x+n} \right] \]
where the value \( g \) and the coefficients \( (c_0, c_1, \ldots, c_n) \) are taken from Paul Godfrey, whose note can be found here: http://my.fit.edu/~gabdo/gamma.txt
|
constexprnoexcept |
Compile-time trunc function.
x | a real-valued input. |
|
static |
|
static |
|
static |
|
static |