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

◆ pow

eve::pow = functor<pow_t>
inlineconstexpr

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
}
Specifies that a type is a Conditional Expression.
Definition: conditional.hpp:27
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition: value.hpp:107
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition: value.hpp:33
constexpr auto pow
Callable object computing the pow operation .
Definition: pow.hpp:119
EVE Main Namespace.
Definition: abi.hpp:18

Parameters

Return value

  1. 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

  1. faster but less accurate call

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::wide pf = {4.0f, 1.0f, -1.0f, 0.5f, 0.0f, 0.0f, -0.0f, 2.5f};
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";
}
constexpr auto nan
Computes the IEEE quiet NaN constant.
Definition: nan.hpp:67
constexpr auto minf
Computes the -infinity ieee value.
Definition: minf.hpp:66
constexpr auto inf
Computes the infinity ieee value.
Definition: inf.hpp:66
Lightweight type-wrapper.
Definition: as.hpp:29
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition: conditional.hpp:304
Wrapper for SIMD registers.
Definition: wide.hpp:71