Callable object computing the natural logarithm: \(\log x\).
Defined in Header
#include <eve/module/math.hpp>
{
template< eve::floating_value T >
template< eve::floating_value T >
}
constexpr callable_log_ log
Callable object computing the natural logarithm: .
Definition: log.hpp:98
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
x
: \(\log x\).
- If the element is \(\pm0\), \(-\infty\) is returned.
- If the element is \(1\), \(+0\) is returned.
- If the element is \(\infty\), \(\infty\) is returned.
- If the element is less than 0,
NaN
is returned.
- Returns elementwise the natural logarithm of the input in the range of a strip in the interval \(i\times[-\pi, \pi]\) along the imaginary axis and mathematically unbounded along the real axis. .
- The function is continuous onto the branch cut along the negative real axis, taking into account the sign of imaginary part
- for every z:
eve::log(eve::conj(z)) == eve::conj(eve::log(z))
- If z is \(-0\), the result is \(-\infty+i \pi \)
- If z is \(+0\), the result is \(-\infty\)
- If z is \(x+i \infty\) (for any finite x), the result is \(+\infty+i \pi/2\)
- If z is \(x+i NaN\) (for any finite x), the result is \(NaN+i NaN\)
- If z is \(-\infty+i y\) (for any finite positive y), the result is \(+\infty+i \pi \)
- If z is \(+\infty+i y\) (for any finite positive y), the result is \(+\infty\)
- If z is \(-\infty+i \infty\), the result is \(+\infty+i 3\pi/4\)
- If z is \(+\infty+i \infty\), the result is \(+\infty+i \pi/4\)
- If z is \(\pm\infty+i NaN\), the result is \(+\infty+i NaN\)
- If z is \(NaN+i y\) (for any finite y), the result is \(NaN+i NaN\)
- If z is \(NaN+i \infty\), the result is \(+\infty+i NaN\)
- If z is \(NaN+i NaN\), the result is \(NaN+i NaN\)
Real version
#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'
<<
"-> log(pf) = " <<
eve::log(pf) <<
'\n';
float xf = 1.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<<
"-> log(xf) = " <<
eve::log(xf) <<
'\n';
return 0;
}
constexpr callable_nan_ nan
Computes the IEEE NaN constant.
Definition: nan.hpp:53
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
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
<<
"-> log(z) = " <<
eve::log(z) << std::endl;
return 0;
}