kyosu v0.1.0
Complex Without Complexes
Loading...
Searching...
No Matches

◆ cbrt

auto kyosu::cbrt = eve::functor<cbrt_t>
inlineconstexpr

Computes the the kth cubic root of the argument.

Header file

#include <kyosu/functions.hpp>

Callable Signatures

namespace kyosu
{
// regular call
constexpr auto cbrt(complex_like z, auto k) noexcept;
constexpr auto cbrt(complex_like z) noexcept;
// semantic modifyers
constexpr Z cbrt[real_only](Real z) noexcept;
}
constexpr auto k
Computes the complex number k i.e. quaternion(0, 0, 0, 1) in the chosen type.
Definition k.hpp:74
constexpr auto cbrt
Computes the the kth cubic root of the argument.
Definition cbrt.hpp:76
Main KYOSU namespace.
Definition cinf.hpp:13

Parameters

  • z: Value to process. floating or complex.
  • k: kth cubic root.

Return value

  • A real typed input z is treated as if complex(z) was entered unless the option real_only is used in which case the parameter must be a floating_value, the real part of the result will the same as an
  • the kth cubic root of z, is exp((log(z)+2*k*i*pi)/3). If not present k is taken as 0.

External references

Example

#include <eve/wide.hpp>
#include <iostream>
#include <kyosu/kyosu.hpp>
int main()
{
using kyosu::cbrt;
using wi_t = eve::wide<unsigned int, eve::fixed<4>>;
using wf_t = eve::wide<float, eve::fixed<4>>;
wi_t wk = eve::iota(eve::as<wi_t>()) + 1;
wf_t wf{5.0f, 2.3f, -1.2f, 0.0f};
std::cout << "wk " << wk << std::endl;
std::cout << "wf " << wf << std::endl;
std::cout << "kyosu::cbrt(16.0, wk) " << kyosu::cbrt(16.0, wk) << std::endl;
std::cout << "kyosu::cbrt(wf, wk) " << kyosu::cbrt(wf, wk) << std::endl;
std::cout << "kyosu::cbrt(wf) " << kyosu::cbrt(wf) << std::endl;
return 0;
}
as_cayley_dickson_n_t< 2, T > complex_t
Type alias for complex numbers.
Definition complex.hpp:27