E.V.E
v2023.02.15
Loading...
Searching...
No Matches
Inverse trigonometric

Detailed Description

These functions allows performing inverse trigonometric computations. As the direct functions they admit options such that the return value is exprressed in radian, degrees or \(\pi\) multiples, namely eve::rad, eve::deg and eve::radpi.

Variables

constexpr auto eve::acos = functor<acos_t>
 elementwise_callable object computing the arc cosine.
constexpr auto eve::acot = functor<acot_t>
 elementwise_callable object computing the arc cotangent.
constexpr auto eve::acsc = functor<acsc_t>
 Callable object computing the arc cosecant.
constexpr auto eve::asec = functor<asec_t>
 Callable object computing the arc secant.
constexpr auto eve::asin = functor<asin_t>
 elementwise_callable object computing the arc sine.
constexpr auto eve::atan = functor<atan_t>
 elementwise_callable object computing the arc tangent.
constexpr auto eve::atan2 = functor<atan2_t>
 elementwise_callable object computing the arc tangent using the signs of the arguments to determine the correct quadrant.

Variable Documentation

◆ acos

auto eve::acos = functor<acos_t>
inlineconstexpr

elementwise_callable object computing the arc cosine.

Header file

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overloads
constexpr auto acos(floating_value auto x) noexcept; // 1
// Semantic option
constexpr auto acos[raw](floating_value auto x) noexcept; // 2
constexpr auto acos[fast] (floating_value auto x) noexcept; // 3
constexpr auto acos[rad](floating_value auto x) noexcept; // 1
constexpr auto acos[deg](floating_value auto x) noexcept; // 4
constexpr auto acos[pirad](floating_value auto x) noexcept; // 5
// Lanes masking
constexpr auto acos[conditional_expr auto c](floating_value auto x) noexcept; // 6
constexpr auto acos[logical_value auto m](floating_value auto x) noexcept; // 6
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:116
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:134
constexpr auto raw
Performs the operation minimally, trading accuracy for speed.
Definition core.hpp:95
constexpr auto fast
Performs the operation faster than the regular call while keeping more accuracy than raw.
Definition core.hpp:79
constexpr auto acos
elementwise_callable object computing the arc cosine.
Definition acos.hpp:95
EVE Main Namespace.
Definition abi.hpp:19

Parameters

Return value

  1. Returns the elementwise arc cosine in radians of the input in the range \([0 , \pi]\). In particular:
    • If x is \(1\), \(+0\) is returned.
    • If \(|x| > 1\), NaN is returned.
    • If x is a NaN, NaN is returned.
  2. very fast but accuracy not better than 5.0e-4.
  3. Same as 1 but uses a faster implementation which can be slightly less accurate near x = 1
  4. Result in degrees
  5. Result in \(\pi\) multiples
  6. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
#include <iomanip>
int main()
{
eve::wide wf = { 0.0f, 0.99f, -1.0f, -0.5f, -0.0f, 0.25f, 1.0f, -2.0f};
std::cout << "<- wf = " << wf << "\n";
std::cout << std::setprecision(10);
std::cout << "-> acos(wf) = " << eve::acos(wf) << "\n";
std::cout << "-> acos[deg](wf) = " << eve::acos[eve::deg](wf) << "\n";
std::cout << "-> acos[radpi](wf) = " << eve::acos[eve::radpi](wf) << "\n";
std::cout << "-> acos[rad](wf) = " << eve::acos[eve::rad](wf) << "\n";
std::cout << "-> acos[raw](wf) = " << eve::acos[eve::raw](wf) << "\n";
std::cout << "-> acos[ignore_last(2)](wf)= " << eve::acos[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> acos[wf != -2.0f](wf) = " << eve::acos[wf != -2.0f](wf) << "\n";
}
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition conditional.hpp:361
Wrapper for SIMD registers.
Definition wide.hpp:94

◆ acot

auto eve::acot = functor<acot_t>
inlineconstexpr

elementwise_callable object computing the arc cotangent.

Header file

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto acot(floating_value auto x) noexcept; // 1
// Semantic option
constexpr auto acot[raw](floating_value auto x) noexcept; // 2
constexpr auto acot[fast] (floating_value auto x) noexcept; // 3
constexpr auto acot[rad](floating_value auto x) noexcept; // 1
constexpr auto acot[deg](floating_value auto x) noexcept; // 4
constexpr auto acot[pirad](floating_value auto x) noexcept; // 5
// Lanes masking
constexpr auto acot[conditional_expr auto c](floating_value auto x) noexcept; // 6
constexpr auto acot[logical_value auto m](floating_value auto x) noexcept; // 6
}
constexpr auto acot
elementwise_callable object computing the arc cotangent.
Definition acot.hpp:89

Parameters

Return value

  1. Returns the elementwise arc cotangent in radians of the input in the range \([-\frac\pi2, \frac\pi2]\). In particular:
    • If the element is \(\pm0\), \(\pm\frac\pi2\) is returned.
    • If the element is \(\pm\infty\), \(\pm0\) is returned.
    • If the element is a Nan, NaN is returned.
  2. very fast but accuracy not better than 5.0e-3 according Abramowitz & Stegun.
  3. accuracy not better than 5.0e-35according Abramowitz & Stegun.
  4. Result in degrees
  5. Result in \(\pi\) multiples
  6. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide wf = { 0.0f, 2.0f, -1.0f, -0.5f};
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> acot(wf) = " << eve::acot(wf) << "\n";
std::cout << "-> acot[deg](wf) = " << eve::acot[eve::deg](wf) << "\n";
std::cout << "-> acot[radpi](wf) = " << eve::acot[eve::radpi](wf) << "\n";
std::cout << "-> acot[rad](wf) = " << eve::acot[eve::rad](wf) << "\n";
std::cout << "-> acot[ignore_last(2)](wf)= " << eve::acot[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> acot[wf != 2.0f](wf) = " << eve::acot[wf != 2.0f](wf) << "\n";
}

◆ acsc

auto eve::acsc = functor<acsc_t>
inlineconstexpr

Callable object computing the arc cosecant.

Header file

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto acsc(floating_value auto x) noexcept; // 1
// Semantic option
constexpr auto acsc[raw](floating_value auto x) noexcept; // 2
constexpr auto acsc[fast](floating_value auto x) noexcept; // 3
constexpr auto acsc[rad](floating_value auto x) noexcept; // 1
constexpr auto acsc[deg](floating_value auto x) noexcept; // 4
constexpr auto acsc[pirad](floating_value auto x) noexcept; // 5
// Lanes masking
constexpr auto acsc[conditional_expr auto c](floating_value auto x) noexcept; // 6
constexpr auto acsc[logical_value auto m](floating_value auto x) noexcept; // 6
}
constexpr auto acsc
Callable object computing the arc cosecant.
Definition acsc.hpp:89

Parameters

Return value

  1. Returns the elementwise arc cosecant of the input in the range \([-\pi/2 , \pi/2]\). In particular:
    • If the element is \(\pm1\), \(\pm\frac\pi2\) is returned.
    • If the element \(|x| < 1\), NaN is returned.
    • If the element is \(\pm\infty\), \(\pm0\) is returned.
    • If the element is a Nan, NaN is returned.
  2. very fast but accuracy not better than 5.0e-3 according Abramowitz & Stegun.
  3. accuracy not better than 5.0e-5 according Abramowitz & Stegun.
  4. Result in \(\pi\) multiples
  5. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide wf = { 0.0f, 2.0f, -1.0f, -0.5f};
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> acsc(wf) = " << eve::acsc(wf) << "\n";
std::cout << "-> acsc[deg](wf) = " << eve::acsc[eve::deg](wf) << "\n";
std::cout << "-> acsc[radpi](wf) = " << eve::acsc[eve::radpi](wf) << "\n";
std::cout << "-> acsc[rad](wf) = " << eve::acsc[eve::rad](wf) << "\n";
std::cout << "-> acsc[ignore_last(2)](wf)= " << eve::acsc[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> acsc[wf != 2.0f](wf) = " << eve::acsc[wf != 2.0f](wf) << "\n";
}

◆ asec

auto eve::asec = functor<asec_t>
inlineconstexpr

Callable object computing the arc secant.

Header file

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto asec(floating_value auto x) noexcept; // 1
// Semantic option
constexpr auto asec[raw](floating_value auto x) noexcept; // 2
constexpr auto asec[fast](floating_value auto x) noexcept; // 3
constexpr auto asec[rad](floating_value auto x) noexcept; // 1
constexpr auto asec[deg](floating_value auto x) noexcept; // 4
constexpr auto asec[pirad](floating_value auto x) noexcept; // 5
!
// Lanes masking
constexpr auto asec[conditional_expr auto c](floating_value auto x) noexcept; // 6
constexpr auto asec[logical_value auto m](floating_value auto x) noexcept; // 6
}
constexpr auto asec
Callable object computing the arc secant.
Definition asec.hpp:89

Parameters

Return value

  1. Returns the elementwise arc cosecant of the input in the range \([0 , \pi]\). In particular:
    • If the element is \(1\), \(+0\) is returned.
    • If the element is \(0\), \(\pi\) is returned.
    • If the element \(|x| < 1\), NaN is returned.
    • If the element is a Nan, NaN is returned.
  2. very fast but accuracy not better than 5.0e-4.
  3. Same as 1 but uses a faster implementation which can be slightly less accurate near x = 1
  4. Result in \(\pi\) multiples
  5. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
#include <iomanip>
int main()
{
eve::wide wf = { 5.0f, 2.0f, -1.0f, -2.0f, -5.0f, 1.001f, -1.0f, 0.0f};
std::cout << "<- wf = " << wf << "\n";
std::cout << std::setprecision(10);
std::cout << "-> asec(wf) = " << eve::asec(wf) << "\n";
std::cout << "-> asec[deg](wf) = " << eve::asec[eve::deg](wf) << "\n";
std::cout << "-> asec[radpi](wf) = " << eve::asec[eve::radpi](wf) << "\n";
std::cout << "-> asec[rad](wf) = " << eve::asec[eve::rad](wf) << "\n";
std::cout << "-> asec[raw](wf) = " << eve::asec[eve::raw](wf) << "\n";
std::cout << "-> asec[ignore_last(2)](wf)= " << eve::asec[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> asec[wf != 2.0f](wf) = " << eve::asec[wf != 2.0f](wf) << "\n";
}

◆ asin

auto eve::asin = functor<asin_t>
inlineconstexpr

elementwise_callable object computing the arc sine.

Header file

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto asin(floating_value auto x) noexcept; // 1
// Semantic option
constexpr auto acos[raw](floating_value auto x) noexcept; // 2
constexpr auto acos[fast] (floating_value auto x) noexcept; // 3
constexpr auto acos[rad](floating_value auto x) noexcept; // 1
constexpr auto acos[deg](floating_value auto x) noexcept; // 4
constexpr auto acos[pirad](floating_value auto x) noexcept; // 5
// Lanes masking
constexpr auto asin[conditional_expr auto c](floating_value auto x) noexcept; // 6
constexpr auto asin[logical_value auto m](floating_value auto x) noexcept; // 6
}
constexpr auto asin
elementwise_callable object computing the arc sine.
Definition asin.hpp:99

Parameters

Return value

  1. Returns the elementwise arc sine of the input in the range \([-\frac\pi2, \frac\pi2]\). In particular:
    • If the element is \(\pm0\), \(\pm0\) is returned unmodified.
    • If the element \(|x| > 1\), NaN is returned.
    • If the element is a NaN, NaN is returned.
  2. very fast around 1.0e-5 accuracy.
  3. Same as 2.
  4. Result in degrees
  5. Result in \(\pi\) multiples
  6. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide wf = { 0.0f, 0.99f, -1.0f, -0.5f, -0.0f, 0.25f, 1.0f, -2.0f};
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> asin(wf) = " << eve::asin(wf) << "\n";
std::cout << "-> asin[deg](wf) = " << eve::asin[eve::deg](wf) << "\n";
std::cout << "-> asin[radpi](wf) = " << eve::asin[eve::radpi](wf) << "\n";
std::cout << "-> asin[rad](wf) = " << eve::asin[eve::rad](wf) << "\n";
std::cout << "-> asin[ignore_last(2)](wf)= " << eve::asin[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> asin[wf != -2.0f](wf) = " << eve::asin[wf != -2.0f](wf) << "\n";
}

◆ atan

auto eve::atan = functor<atan_t>
inlineconstexpr

elementwise_callable object computing the arc tangent.

Header file

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto atan(floating_value auto x) noexcept; // 1
// Semantic option
constexpr auto atan[raw](floating_value auto x) noexcept; // 2
constexpr auto atan[fast] (floating_value auto x) noexcept; // 3
constexpr auto atan[rad](floating_value auto x) noexcept; // 1
constexpr auto atan[deg](floating_value auto x) noexcept; // 4
constexpr auto atan[pirad](floating_value auto x) noexcept; // 5
// Lanes masking
constexpr auto atan[conditional_expr auto c](floating_value auto x) noexcept; // 6
constexpr auto atan[logical_value auto m](floating_value auto x) noexcept; // 6
}
constexpr auto atan
elementwise_callable object computing the arc tangent.
Definition atan.hpp:92

Parameters

Return value

  1. Returns the elementwise arc tangent of the input in the range \([-\frac\pi2, \frac\pi2]\). In particular:
    • If the element is \(\pm0\), \(\pm0\) is returned.
    • If the element is \(\pm\infty\), \(\pm\frac\pi2\) is returned.
    • If the element is a Nan, NaN is returned.
  2. very fast but accuracy not better than 5.0e-3 according Abramowitz & Stegun.
  3. accuracy not better than 5.0e-5 according Abramowitz & Stegun.
  4. Result in degrees
  5. Result in \(\pi\) multiples
  6. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide wf = { 0.0f, 0.99f, -1.0f, -0.5f, -5.0f, 6.25f, 1.0f, -2.0f};
std::cout << "<- wf = " << wf << "\n";
std::cout << "-> atan(wf) = " << eve::atan(wf) << "\n";
std::cout << "-> atan[deg](wf) = " << eve::atan[eve::deg](wf) << "\n";
std::cout << "-> atan[radpi](wf) = " << eve::atan[eve::radpi](wf) << "\n";
std::cout << "-> atan[rad](wf) = " << eve::atan[eve::rad](wf) << "\n";
std::cout << "-> atan[ignore_last(2)](wf)= " << eve::atan[eve::ignore_last(2)](wf) << "\n";
std::cout << "-> atan[wf != -2.0f](wf) = " << eve::atan[wf != -2.0f](wf) << "\n";
}

◆ atan2

auto eve::atan2 = functor<atan2_t>
inlineconstexpr

elementwise_callable object computing the arc tangent using the signs of the arguments to determine the correct quadrant.

Header file

#include <eve/module/core.hpp>

Callable Signatures

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto atan2(floating_value auto x, floating_value auto y) noexcept; // 1
// Semantic option
constexpr auto atan2[rad](floating_value auto x, floating_value auto y) noexcept; // 1.a
constexpr auto atan2[deg](floating_value auto x, floating_value auto y) noexcept; // 1.b
constexpr auto atan2[pirad](floating_value auto x, floating_value auto y) noexcept; // 1.c
constexpr auto atan2[pedantic](floating_value auto x, floating_value auto y) noexcept; // 2
// Lanes masking
constexpr auto atan2[conditional_expr auto c][floating_value auto x, floating_value auto y) noexcept; // 3
constexpr auto atan2[logical_value auto m](floating_value auto x, floating_value auto y) noexcept; // 3
}
constexpr auto pedantic
Follows the corner cases of the corresponding standard function.
Definition core.hpp:91
constexpr auto atan2
elementwise_callable object computing the arc tangent using the signs of the arguments to determine t...
Definition atan2.hpp:114

Parameters

Return value

  1. The arc tangent of \(\frac{y}x\) in the radian range \([-\pi , +\pi]\) (1.a) , is returned. (converted in degrees (1.b) or in \([\pi\) multiples (1.c)) For 1.a The IEEE limiting values are almost all satisfied :
    • If x and y are both zero or infinites, Nan is returned (this is not standard conforming)
    • If y is \(\pm0\) and x is strictly negative or \(-0\), \(\pm\pi\) is returned
    • If y is \(\pm0\) and x is strictly positive or \(+0\), \(\pm0\) is returned
    • If y is \(\pm\infty\) and x is finite, \(\pm\frac\pi2\) is returned
    • If x is \(\pm0\) and y is strictly negative, \(-\frac\pi2\) is returned
    • If x is \(\pm0\) and y is strictly positive, \(+\frac\pi2\) is returned
    • If x is \(-\infty\) and y is finite and positive, \(+\pi\) is returned
    • If x is \(-\infty\) and y is finite and negative, \(-\pi\) is returned
    • If x is \(+\infty\) and y is finite and positive, \(+0\) is returned
    • If x is \(+\infty\) and y is finite and negative, \(-0\) is returned
    • If either x is Nan or y is Nan, Nan is returned

The call will return a NaN if x and y are both either null or infinite: this result is not IEEE conformant, but allows to simplify (and speed up) the implementation. In all other cases, the result is standard conformant. And the converted equivalent are returned with the other units.

  1. Same as 1, except that all IEEE limiting values are satisfied :
    • If y is \(\pm\infty\) and x is \(-\infty\), \(\pm\frac{3\pi}4\) is returned
    • If y is \(\pm\infty\) and x is \(+\infty\), \(\pm\frac{\pi}4\) is returned
    • If x is \(\pm0\) and y is \(\pm-0\), \(-\frac\pi2\) is returned
    • If x is \(\pm0\) and y is \(\pm+0\), \(+\frac\pi2\) is returned
  2. The operation is performed conditionally.

External references

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide pf = { 0.0f, 1.0f, 4.0f, -2.0f, eve::inf(eve::as<float>()), 0.0f, eve::minf(eve::as<float>()), 1.0f};
eve::wide qf = { 1.0f, -1.0f, 3.0f, -0.0f, 1.0f, 0.0f, 0.0f, -0.0f};
std::cout << "<- pf = " << pf << "\n";
std::cout << "<- qf = " << qf << "\n";
std::cout << "-> atan2(pf, qf) = " << eve::atan2(pf, qf) << "\n";
std::cout << "-> atan2[deg](pf, qf) = " << eve::atan2[eve::deg](pf, qf) << "\n";
std::cout << "-> atan2[radpi](pf, qf) = " << eve::atan2[eve::radpi](pf, qf) << "\n";
std::cout << "-> atan2[rad](pf, qf) = " << eve::atan2[eve::rad](pf, qf) << "\n";
std::cout << "-> atan2[pedantic](pf, qf) = " << eve::atan2[eve::pedantic](pf, qf) << "\n";
std::cout << "-> atan2[ignore_last(2)](pf, qf)= " << eve::atan2[eve::ignore_last(2)](pf, qf) << "\n";
std::cout << "-> atan2[pf != -2.0f](pf, qf) = " << eve::atan2[pf != -2.0f](pf, qf) << "\n";
}
constexpr auto inf
Computes the infinity ieee value.
Definition inf.hpp:67
constexpr auto minf
Computes the -infinity ieee value.
Definition minf.hpp:67
Lightweight type-wrapper.
Definition as.hpp:29