E.V.E
v2023.02.15
 
Loading...
Searching...
No Matches

◆ factorial

auto eve::factorial = functor<factorial_t>
inlineconstexpr

Callable Signatures

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
template <value T> constexpr as_wide_as_t<double,T> factorial(T x) noexcept; // 1
// Lanes masking
constexpr auto factorial[conditional_expr auto c](value auto n) noexcept; // 2
constexpr auto factorial[logical_value auto m](value auto n) noexcept; // 2
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:132
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition value.hpp:34
constexpr auto factorial
elementwise_callable computing .
Definition factorial.hpp:79
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value

  1. The value of \( n!\) is returned. If the entry is of integral type a double based floating_value is returned.
  2. The operation is performed conditionnaly
Warning
This function will overflow as soon as the input is greater than 171 for integral or double entries and if the entry is greater than 34 for float.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide<float> wf([](auto i, auto c)->float{ return 2*(i+c/2);});
eve::wide wi = {93, 25, 32, 180, 1, 2, 3, 4};
eve::wide<std::uint32_t> wu([](auto i, auto )->std::uint32_t{ return i;});
std::cout << "<- wf = " << wf << "\n";
std::cout << "<- wi = " << wi << "\n";
std::cout << "<- wu = " << wu << "\n";
std::cout << "-> factorial(wf) = " << eve::factorial(wf) << "\n";
std::cout << "-> factorial(wi) = " << eve::factorial(wi) << "\n";
std::cout << "-> factorial(wu) = " << eve::factorial(wu) << "\n";
}
Wrapper for SIMD registers.
Definition wide.hpp:86