Callable object computing the natural logarithm of \(1+x\): \(\log(1+x)\).
Defined in Header
#include <eve/module/math.hpp>
{
template< eve::floating_value T >
template< eve::floating_value T >
}
constexpr callable_log1p_ log1p
Callable object computing the natural logarithm of : .
Definition: log1p.hpp:81
Definition: all_of.hpp:22
SIMD-compatible representation of complex numbers.
Definition: complex.hpp:40
Parameters
Return value
- Returns the elementwise the natural logarithm of
1+x
This function is more precise than the expression log(1+x)
if x
is close to zero. In particular:
- If the element is \(\pm0\), \(-\infty\) is returned.
- If the element is \(\pm0\), \(+0\) is returned.
- If the element is \(\infty\), \(\infty\) is returned.
- If the element is less than -1,
NaN
is returned.
- Returns elementwise the natural logarithm of
1+z
. The behavior of this function is equivalent to eve::log(1+z), with better precision when
z` is close to zero.
Real version
#include <eve/module/math.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'
;
float xf = 3.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65
Complex version
#include <eve/module/complex.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft ref = { 0.0f, 1.0f, -1.0f, 0.5f};
wide_ft imf = { 2.0f , -1.0, -5.0, 0.0};
auto z = eve::as_complex_t<wide_ft>(ref, imf);
std::cout
<< "---- simd" << std::endl
<< "<- z = " << z << std::endl
<<
"-> log1p(z) = " <<
eve::log1p(z) << std::endl;
return 0;
}