E.V.E
v2022.03.00

◆ acosh

eve::acosh = {}
inlineconstexpr

Callable object computing \(\log(x+\sqrt{x^2-1})\).

Defined in Header

#include <eve/module/math.hpp>

Callable Signatures

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

Parameters

Return value

  1. Returns the elementwise inverse hyperbolic cosine of the input. For values in the domain x>1, the inverse hyperbolic cosine is semantically equivalent to \(\log(x+\sqrt{x^2-1})\).

    In particular:

    • If the element is less than \(1\) or Nan, NaN is returned.
    • If the element is \(1\), \(+0\) is returned.
    • If the element is \(+\infty\), \(+\infty\) is returned.
    • If the element is a Nan, NaN is returned.
  2. Returns the complex arc hyperbolic cosine of z, in the range of a strip unbounded along the imaginary axis and in the interval \([0,\pi]\) along the real axis.
    • for every z: eve::acosh(eve::conj(z)) == eve::conj(std::acosh(z))
    • If z is \(\pm0\), the result is \(i pi/2\)
    • If z is \(\pm0\), the result is \(+0,\pi/2\)
    • 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 non zero x), the result is \(NaN+i NaN\).
    • If z is \(i NaN\) the result is \(NaN+i\pi/2\).
    • If z is \(-\infty,y\) (for any positive finite y), the result is \(+\infty,\pi\)
    • If z is \(+\infty,y\) (for any positive finite y), the result is \(+\infty+i 0\)
    • If z is \(-\infty+i \infty\), the result is \(+\infty,3\pi/4\)
    • If z is \(\pm\infty+i NaN\), the result is \(+\infty+i NaN\)
    • If z is \(NaN,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\)

Example

Real version

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