E.V.E
v2023.02.15

◆ expm1

eve::expm1 = {}
inlineconstexpr

Callable object computing \(e^x-1\).

Defined in Header

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
template< eve::floating_value T >
T expm1(T x) noexcept; //1
template< eve::floating_value T >
as_complex_t<T> expm1(as_complex_t<T> z) noexcept; //2
}
constexpr callable_expm1_ expm1
Callable object computing .
Definition: expm1.hpp:74
Definition: abi.hpp:18

Parameters

Return value

  1. Returns the elementwise exponential of the input minus one, with good accuracy, even for small values of x.
    • If the element is \(\pm0\), \(\pm0\) is returned
    • If the element is \(-\infty\), \(-1\) is returned
    • If the element is \(\infty\), \(\infty\) is returned
    • If the element is a NaN, NaN is returned
  2. Returns elementwise the exponential of the input minus one, with good accuracy, even for small values of eve::abs(z).

Example

#include <eve/module/math.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = {0.0f, -0.0f, -1.0f, 1.0f, eve::eps(eve::as<float>()),
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> expm1(pf) = " << eve::expm1(pf) << '\n'
;
float xf = 1.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> expm1(xf) = " << eve::expm1(xf) << '\n';
return 0;
}
constexpr callable_eps_ eps
Computes the the machine epsilon.
Definition: eps.hpp:63
constexpr callable_nan_ nan
Computes the IEEE NaN constant.
Definition: nan.hpp:53
constexpr callable_minf_ minf
Computes the -infinity ieee value.
Definition: minf.hpp:60
constexpr callable_inf_ inf
Computes the infinity ieee value.
Definition: inf.hpp:58
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65

Semantic Modifiers

  • Masked Call

    The call eve::expm1[mask](x) provides a masked version of eve::expm1 which is equivalent to if_else (mask, expm1(x), x).

    Example

    #include <eve/module/math.hpp>
    #include <eve/wide.hpp>
    #include <iostream>
    int main()
    {
    wide_ft pf = {0.0f, -0.0f, -1.0f, 1.0f, 2.0f,
    std::cout << "---- simd" << '\n'
    << "<- pf = " << pf << '\n'
    << "-> exp2[pf > 1.0](pf) = " << eve::exp2[pf > 1.0](pf) << '\n';
    return 0;
    }
    constexpr callable_exp2_ exp2
    Callable object computing .
    Definition: exp2.hpp:99