E.V.E  0.1-beta

◆ exp2

eve::exp2 = {}
inlineconstexpr

Callable object computing \(2^x\).

Required header: #include <eve/function/exp2.hpp>

Members Functions

Member Effect
operator() computes the base 2 exponential
operator[] Construct a conditional version of current function object

auto operator()( real_value x ) const noexcept;
Definition: value.hpp:93

Parameters

x: real value.

Return value

Returns the elementwise exponential of base 2 of the input. In particular, for floating inputs:

  • If the element is \(\pm0\), \(1\) is returned
  • If the element is \(-\infty\), \(+0\) is returned
  • If the element is \(\infty\), \(\infty\) is returned
  • If the element is a NaN, NaN is returned

auto operator[]( conditional_expression auto cond ) const noexcept;

Higher-order function generating a masked version of eve::exp2

Parameters

cond : conditional expression

Return value

A Callable object so that the expression exp2[cond](x, ...) is equivalent to if_else(cond,exp2(x, ...),x)


Supported converters

  • eve::float_, eve::double_, eve::floating_

    The expression d(exp2)(x) where d in one of these 3 converters is supported if x is an integral value and produce a floating point output.

Supported decorators

Example

See it live on Compiler Explorer

#include <eve/function/exp2.hpp>
#include <eve/wide.hpp>
#include <eve/constant/inf.hpp>
#include <eve/constant/minf.hpp>
#include <eve/constant/nan.hpp>
#include <iostream>
int main()
{
wide_ft pf = {0.0f, -0.0f, -1.0f, 33.0f, 2.0f,
wide_it pi = {0, 2, 8, 33};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "<- pi = " << pi << '\n'
<< "-> exp2(pf) = " << eve::exp2(pf) << '\n'
<< "-> exp2(pi) = " << eve::exp2(pi) << '\n'
<< "-> float32(exp2)(pi) = " << eve::float32(eve::exp2)(pi) << '\n'
<< "-> float64(exp2)(pi) = " << eve::float64(eve::exp2)(pi) << '\n'
<< "-> floating_(exp2)(pi) = " << eve::floating_(eve::exp2)(pi) << '\n'
<< "-> float32(exp2(pi)) = " << eve::float32(eve::exp2(pi)) << '\n'
<< "-> float64(exp2(pi)) = " << eve::float64(eve::exp2(pi)) << '\n'
<< "-> floating_(exp2(pi)) = " << eve::floating_(eve::exp2(pi)) << '\n';
float xf = 1.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> exp2(xf) = " << eve::exp2(xf) << '\n';
return 0;
}
constexpr callable_nan_ nan
Callable object computing the nan value.
Definition: nan.hpp:52
constexpr callable_pi_ pi
Callable object computing the value.
Definition: pi.hpp:54
constexpr callable_minf_ minf
Callable object computing the negative infinity value.
Definition: minf.hpp:55
constexpr callable_inf_ inf
Callable object computing the infinity ieee value.
Definition: inf.hpp:54
constexpr converter_type< float > const float32
convert a eve::real_value to a float32 based eve::floating_real_value.
Definition: converter.hpp:133
constexpr converter_type< double > const float64
convert a eve::real_value to a float64 based eve::floating_real_value.
Definition: converter.hpp:157
constexpr floating_converter const floating_
convert a eve::real_value to a floating point based eve::floating_real_value of same size.
Definition: converter.hpp:433
constexpr callable_exp2_ exp2
Callable object computing .
Definition: exp2.hpp:122
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65