E.V.E  0.1-beta

◆ log1p

eve::log1p = {}
inlineconstexpr

Callable object computing the natural logarithm of \(1+x\): \(\log(1+x)\).

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

Members Functions

Member Effect
operator() the computation of the natural logarithm of \(1+x\)
operator[] Construct a conditional version of current function object

auto operator()( floating_value auto x ) const noexcept;
Definition: value.hpp:83

Parameters

x: floating real value.

Return value

Returns the elementwise the natural log1parithm of 1+x This function is more precise than the expression log(1+x) if arg is close to zero.

In particular, for floating inputs:

  • If the element is \(-1\), \(-\infty\) is returned.
  • If the element is \(\pm0\), \(\pm0\) is returned.
  • If the element is \(\infty\), \(\infty\) is returned.
  • If the element is less than -1, NaN is returned.

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

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

Parameters

cond : conditional expression

Return value

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


Supported decorators

Example

See it live on Compiler Explorer

#include <eve/function/log1p.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = {-1.0f, 2.0f, -0.0f, 0.0f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> log1p(pf) = " << eve::log1p(pf) << '\n';
float xf = 3.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> log1p(xf) = " << eve::log1p(xf) << '\n';
return 0;
}
constexpr callable_log1p_ log1p
Callable object computing the natural logarithm of : .
Definition: log1p.hpp:85
Wrapper for SIMD registers.
Definition: wide.hpp:65