Computes the principal branch of the base 2 logarithm of the argument.
{
template<kyosu::concepts::cayley_dickson_like T>
constexpr complexify_t<T>
log2(T z)
noexcept;
template<kyosu::concepts::cayley_dickson_like T>
constexpr complexify_t<T>
log2(T z eve::value
k)
noexcept;
template<concepts::real T>
constexpr T
log2[real_only](T 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 log2
Computes the principal branch of the base 2 logarithm of the argument.
Definition log2.hpp:77
Main KYOSU namespace.
Definition cinf.hpp:13
#include <eve/wide.hpp>
#include <iostream>
#include <kyosu/kyosu.hpp>
int main()
{
using e_t = float;
using we_t = eve::wide<e_t, eve::fixed<2>>;
using wc_t = eve::wide<c_t, eve::fixed<2>>;
using wq_t = eve::wide<q_t, eve::fixed<2>>;
std::cout << "Real: \n";
e_t e(2.9f);
we_t we = we_t(e);
std::cout << e <<
" -> " <<
log2(e) <<
"\n";
std::cout << we <<
" -> " <<
log2(we) <<
"\n";
std::cout <<
log2(c_t(e)) <<
"\n";
std::cout <<
log2(q_t(e)) <<
"\n";
std::cout <<
log2(wc_t(e)) <<
"\n";
std::cout <<
log2(wq_t(e)) <<
"\n";
std::cout << "Complex: \n";
c_t c(3.5f, -2.9f);
wc_t wc = wc_t(c);
std::cout << c <<
" -> " <<
log2(c) <<
"\n";
std::cout << wc <<
" -> " <<
log2(wc) <<
"\n";
std::cout <<
log2(q_t(c)) <<
"\n";
std::cout <<
log2(wq_t(c)) <<
"\n";
std::cout << "Quaternion: \n";
q_t q(3.5f, -2.9f, 2.1f, 3.2f);
wq_t wq = wq_t(q);
std::cout << q <<
" -> " <<
log2(q) <<
"\n";
std::cout << wq <<
" -> " <<
log2(wq) <<
"\n";
return 0;
}
as_cayley_dickson_n_t< 2, T > complex_t
Type alias for complex numbers.
Definition complex.hpp:27
as_cayley_dickson_n_t< 4, T > quaternion_t
Type alias for quaternion numbers.
Definition quaternion.hpp:24