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

◆ expm1

auto kyosu::expm1 = eve::functor<expm1_t>
inlineconstexpr

Computes the exponential of the argument minus 1.

Header file

#include <kyosu/functions.hpp>

Callable Signatures

namespace kyosu
{
template<kyosu::concepts::cayley_dickson T> constexpr complexify<T> expm1(T z) noexcept; //1
template<kyosu::concepts::cayley_dickson T> constexpr complexify<T> expm1[radpi](T z) noexcept; //2
template<kyosu::concepts::real T> constexpr T expm1[real_only](T z) noexcept; //3
}
constexpr auto expm1
Computes the exponential of the argument minus 1.
Definition expm1.hpp:63
Main KYOSU namespace.
Definition cinf.hpp:13
compute the cayley dickson type associated to a floating type or any other type.
Definition traits.hpp:193

Parameters

  • z: Value to process.

Return value

  1. Returns the exponential of the argument minus 1. Provisions are made to ensure good precision near zero.
  2. z is multiplied by \(pi\) on input
  3. Equivalent to eve::expm1 call.
Note
As it is a function devoted to better precision, it admits no raw option

Example

#include <eve/wide.hpp>
#include <iostream>
#include <kyosu/kyosu.hpp>
int main()
{
using kyosu::expm1;
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 << " -> " << expm1(e) << "\n";
std::cout << we << " -> " << expm1(we) << "\n";
std::cout << expm1(c_t(e)) << "\n";
std::cout << expm1(q_t(e)) << "\n";
std::cout << expm1(wc_t(e)) << "\n";
std::cout << expm1(wq_t(e)) << "\n";
std::cout << "Complex: \n";
c_t c(3.5f, -2.9f);
wc_t wc = wc_t(c);
std::cout << c << " -> " << expm1(c) << "\n";
std::cout << wc << " -> " << expm1(wc) << "\n";
std::cout << expm1(q_t(c)) << "\n";
std::cout << expm1(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 << " -> " << expm1(q) << "\n";
std::cout << wq << " -> " << expm1(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