Skip to content

Other math functions

factorial function

constexpr uint64_t factorial(int n)

Returns the factorial of an argument. Returns max(uint64_t) if does not fit to uint64_t

Source code
constexpr uint64_t factorial(int n)
{
    if (CMT_LIKELY(n < 0 || n > 20))
        return std::numeric_limits<uint64_t>::max();
    return factorial_table[n];
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/gamma.hpp#L74

factorial_approx function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> factorial_approx(const T1 &x)

Returns the approximate factorial of an argument

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION flt_type<T1> factorial_approx(const T1& x)
{
    return intrinsics::factorial_approx(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/gamma.hpp#L44

gamma function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
flt_type<T1> gamma(const T1 &x)

Returns the approximate gamma function of an argument

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION flt_type<T1> gamma(const T1& x)
{
    return intrinsics::gamma(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/gamma.hpp#L37


Auto-generated from sources, Revision , https://github.com/kfrlib/kfr/blob//include/kfr/