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

Go to the source code of this file.

Namespaces

namespace  internal
 

Functions

template<typename T >
constexpr T internal::erf_cf_large_recur (const T x, const int depth) noexcept
 
template<typename T >
constexpr T internal::erf_cf_large_main (const T x) noexcept
 
template<typename T >
constexpr T internal::erf_cf_small_recur (const T xx, const int depth) noexcept
 
template<typename T >
constexpr T internal::erf_cf_small_main (const T x) noexcept
 
template<typename T >
constexpr T internal::erf_begin (const T x) noexcept
 
template<typename T >
constexpr T internal::erf_check (const T x) noexcept
 
template<typename T >
constexpr return_t< T > erf (const T x) noexcept
 Compile-time Gaussian error function. More...
 

Function Documentation

◆ erf()

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

Compile-time Gaussian error function.

Parameters
xa real-valued input.
Returns
computes the Gaussian error function

\[ \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}}}} \]