E.V.E
v2023.02.15
Loading...
Searching...
No Matches
◆
pow
eve::pow = functor<pow_t>
inline
constexpr
Header file
#include <eve/module/math.hpp>
Callable Signatures
namespace
eve
{
// Regular overload
constexpr
auto
pow
(
value
auto
x
,
value
auto
y
)
noexcept
;
// 1
// Lanes masking
constexpr
auto
pow
[
conditional_expr
auto
c
](
value
auto
x
,
value
auto
y
)
noexcept
;
// 2
constexpr
auto
pow
[
logical_value
auto
m
](
value
auto
x
,
value
auto
y
)
noexcept
;
// 2
// Semantic options
constexpr
auto
pow
[raw](
value
auto
x
,
value
auto
y
)
noexcept
;
// 3
constexpr
auto
pow
[
mod
= p] (
floating_value
auto
x
,
floating_value
auto
y
)
noexcept
;
// 4
}
eve::conditional_expr
Specifies that a type is a Conditional Expression.
Definition
conditional.hpp:28
eve::floating_value
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition
value.hpp:116
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:134
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::pow
constexpr auto pow
Callable object computing the pow operation .
Definition
pow.hpp:123
eve::translate_t
typename decltype(detail::as_translated_type(as< T >{}))::type translate_t
Returns the final translated type of T.
Definition
translation.hpp:107
eve
EVE Main Namespace.
Definition
abi.hpp:19
Parameters
Return value
Returns
elementwise
\(x^y\). In particular we have (IEC 60559):
pow(+0, y), where y is a negative odd integer, returns \(+\infty\)
pow(-0, y), where y is a negative odd integer, returns \(-\infty\)
pow( \(\pm0\), y), where y is negative, finite, and is an even integer or a non-integer, returns \(+\infty\)
pow( \(\pm0\), \(-\infty\)) returns \(+\infty\)
pow(+0, y), where y is a positive odd integer, returns +0
pow(-0, y), where y is a positive odd integer, returns -0
pow( \(\pm0\), y), where y is positive non-integer or a positive even integer, returns +0
pow(-1, \(\pm\infty\)) returns 1
pow(+1, y) returns 1 for any y, even when y is NaN
pow(x, \(\pm0\)) returns 1 for any x, even when x is NaN
pow(x, y)
returns NaN if x is finite and less than 0 and y is finite and non-integer.
pow(x, \(-\infty\)) returns \(+\infty\) for any |x|<1
pow(x, \(-\infty\)) returns +0 for any |x|>1
pow(x, \(+\infty\)) returns +0 for any |x|<1
pow(x, \(+\infty\)) returns \(+\infty\) for any |x|>1
pow( \(-\infty\), y) returns -0 if y is a negative odd integer
pow( \(-\infty\), y) returns +0 if y is a negative non-integer or even integer
pow( \(-\infty\), y) returns \(-\infty\) if y is a positive odd integer
pow( \(-\infty\), y) returns \(+\infty\) if y is a positive non-integer or even integer
pow( \(+\infty\), y) returns +0 for any y less than 0
pow( \(+\infty\), y) returns \(+\infty\) for any y greater than 0
except where specified above, if any argument is NaN, NaN is returned
The operation is performed conditionnaly
faster but less accurate call
compute the result in modular arithmetic. the parameters must be flint positive and less than the modulus. The modulus itself must be less than maxflint.
Example
// revision 1
#include <eve/module/math.hpp>
#include <iostream>
#include <cmath>
int
main
()
{
eve::wide
qf
= {0.0f, 3.0f, -4.0f, 2.0f, 2.0f,
eve::inf
(
eve::as<float>
()),
eve::minf
(
eve::as<float>
()),
eve::nan
(
eve::as<float>
())};
eve::wide
pf
= {4.0f, 1.0f, -1.0f, 0.5f, 0.0f, 0.0f, -0.0f, 2.5f};
eve::wide
pd
= {4.0, 1.0, 12.0, 24.0, 13.0, 0.0, 96.0, 2.0};
std::cout <<
"<- pf = "
<<
pf
<<
"\n"
;
std::cout <<
"<- qf = "
<<
qf
<<
"\n"
;
std::cout <<
"-> pow(pf, qf) = "
<<
eve::pow
(
pf
,
qf
) <<
"\n"
;
std::cout <<
"-> pow[ignore_last(2)](pf, qf)= "
<<
eve::pow
[
eve::ignore_last
(2)](
pf
,
qf
) <<
"\n"
;
std::cout <<
"-> pow[qf > 0.0f](pf, qf) = "
<<
eve::pow
[
qf
> 0.0f](
pf
,
qf
) <<
"\n"
;
std::cout <<
"-> pow[raw](pf, qf) = "
<<
eve::pow
[eve::raw](
pf
,
qf
) <<
"\n"
;
std::cout <<
"<- pd = "
<<
pd
<<
"\n"
;
std::cout <<
"<- pow([mod = 97](pd, 96.0) = "
<<
eve::pow
[
eve::mod
= 97](
pd
, 96.0)<<
" //little Fermat\n"
;
}
eve::nan
constexpr auto nan
Computes the IEEE quiet NaN constant.
Definition
nan.hpp:67
eve::minf
constexpr auto minf
Computes the -infinity ieee value.
Definition
minf.hpp:67
eve::inf
constexpr auto inf
Computes the infinity ieee value.
Definition
inf.hpp:67
eve::ignore_last
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition
conditional.hpp:320
eve::wide
Wrapper for SIMD registers.
Definition
wide.hpp:94
eve