WPILibC++ 2023.4.3-108-ge5452e3
tan.hpp File Reference

Go to the source code of this file.

Namespaces

namespace  internal
 

Functions

template<typename T >
constexpr T internal::tan_series_exp_long (const T z) noexcept
 
template<typename T >
constexpr T internal::tan_series_exp (const T x) noexcept
 
template<typename T >
constexpr T internal::tan_cf_recur (const T xx, const int depth, const int max_depth) noexcept
 
template<typename T >
constexpr T internal::tan_cf_main (const T x) noexcept
 
template<typename T >
constexpr T internal::tan_begin (const T x, const int count=0) noexcept
 
template<typename T >
constexpr T internal::tan_check (const T x) noexcept
 
template<typename T >
constexpr return_t< T > tan (const T x) noexcept
 Compile-time tangent function. More...
 

Function Documentation

◆ tan()

template<typename T >
constexpr return_t< T > tan ( const T  x)
constexprnoexcept

Compile-time tangent function.

Parameters
xa real-valued input.
Returns
the tangent function using

\[ \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.