E.V.E
v2023.02.15
Loading...
Searching...
No Matches
◆
factorial
auto eve::factorial =
functor
<factorial_t>
inline
constexpr
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
}
eve::conditional_expr
Specifies that a type is a Conditional Expression.
Definition
conditional.hpp:28
eve::logical_value
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition
value.hpp:132
eve::value
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition
value.hpp:34
eve::factorial
constexpr auto factorial
elementwise_callable computing .
Definition
factorial.hpp:79
eve
EVE Main Namespace.
Definition
abi.hpp:18
Parameters
n
: must be integral or flint.
c
:
Conditional expression
masking the operation.
m
:
Logical value
masking the operation.
Return value
The value of \( n!\) is returned. If the entry is of integral type a double based
floating_value
is returned.
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
Wolfram MathWorld: Erf
Wikipedia: Error Function
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"
;
}
eve::wide
Wrapper for SIMD registers.
Definition
wide.hpp:70
eve