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

Go to the source code of this file.

Namespaces

namespace  internal
 

Functions

template<typename T >
constexpr T internal::factorial_table (const T x) noexcept
 
template<typename T , typename std::enable_if< std::is_integral< T >::value >::type * = nullptr>
constexpr T internal::factorial_recur (const T x) noexcept
 
template<typename T >
constexpr T factorial (const T x) noexcept
 Compile-time factorial function. More...
 

Function Documentation

◆ factorial()

template<typename T >
constexpr T factorial ( const T  x)
constexprnoexcept

Compile-time factorial function.

Parameters
xa real-valued input.
Returns
Computes the factorial value \( x! \). When 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).