E.V.E
v2022.03.00

◆ atanh

eve::atanh = {}
inlineconstexpr

Callable object computing \(\frac{1}{2}\log((1+x)/(1-x))\).

Defined in Header

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
template< eve::floating_value T >
T atanh(T x) noexcept; //1
template< eve::floating_value T >
}
constexpr callable_atanh_ atanh
Callable object computing .
Definition: atanh.hpp:85
Definition: all_of.hpp:22
SIMD-compatible representation of complex numbers.
Definition: complex.hpp:40

Parameters

Return value

  1. Returns the elementwise inverse hyperbolic cotangent of the input. The inverse hyperbolic sine is semantically equivalent to \(\frac{1}{2}\log((1+x)/(1-x))\).

    In particular:

    • If the element is \(\pm1\), \(\pm\infty\) is returned.
    • If the element is \(\pm0\), \(\pm0\) is returned.
    • If the element is greater than one or a NaN, NaN is returned.

Returns the complex arc hyperbolic sine of z, in the range of a half-strip mathematically unbounded along the real axis and in the interval \(i\times[-\pi/2, \pi/2]\) along the imaginary axis.

  • for every z: eve::atanh(eve::conj(z)) == eve::conj(std::atanh(z))
  • for every z: eve::atanh(-z) == -eve::atanh(z)
  • If z is \(+0\), the result is \(+0\)
  • If z is \(NaN\), the result is \(NaN\)
  • If z is \(+1\), the result is \(+\infty\)
  • If z is \(x+i \infty\) (for any finite positive x), the result is \(+0,\pi/2\)
  • If z is \(x+i NaN\) (for any finite nonzero x), the result is \(NaN+i NaN\)
  • If z is \(+\infty+i y\) (for any finite positive y), the result is \(i \pi/2\)
  • If z is \(+\infty+i \infty\), the result is \(i \pi/2\)
  • If z is \(+\infty+i NaN\), the result is \(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 \(i \pi/2\) (the sign of the real part is unspecified)
  • If z is \(NaN+i NaN\), the result is \(NaN+i NaN\)

Example

Real version

#include <eve/module/math.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = {1.0f, 0.5f, 0.0, -0.5};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> atanh(pf) = " << eve::atanh(pf) << '\n';
float xf = 1.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> atanh(xf) = " << eve::atanh(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
<< "-> atanh(z) = " << eve::atanh(z) << std::endl;
return 0;
}