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

◆ fnma

kyosu::fnma = {}
inlineconstexpr

Computes fused negate multiply add.

Defined in Header

#include <kyosu/functions.hpp>

Callable Signatures

namespace kyosu
{
constexpr auto fnma(auto z0, auto z1, auto z2) noexcept;
}
constexpr tags::callable_fnma fnma
Computes fused negate multiply add.
Definition: fnma.hpp:76
Main KYOSU namespace.
Definition: types.hpp:14

Parameters

  • z0, z1,z2: Values to process.

Return value

The call is semantically equivalent to -z0*z1+z2.

Example

#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
using kyosu::fnma;
using e_t = float;
using we_t = eve::wide<float, eve::fixed<2>>;
using wq_t = eve::wide<kyosu::quaternion_t<float>, eve::fixed<2>>;
std::cout << "Real: "<< "\n";
e_t e0(1);
e_t e1(2);
e_t e2(3);
std::cout << e0 << ", " << e1 << ", " << e2 << " -> " << fnma(e0, e1, e2) << "\n";
std::cout << e0 << ", " << e0 << ", " << e2 << " -> " << fnma(e0, e0, e2) << "\n";
we_t we0(e0);
we_t we1(e1);
we_t we2(e2, e0);
std::cout << we0 << ", " << we1 << ", " << we2<< " -> " << fnma(we0, we1, we2) << "\n";
std::cout << "Complex: "<< "\n";
c_t c0(1, 5);
c_t c1(5, 9);
c_t c2(2, -5);
std::cout << c0 << ", " << c1 << ", " << c2 << " -> " << fnma(c0, c1, e2) << "\n";
std::cout << c0 << ", " << c0 << ", " << c2 << " -> " << fnma(c0, c0, e2) << "\n";
std::cout << "Quaternion: "<< "\n";
q_t q0(1, 5, 2, 3);
q_t q1(5, 9, 6, 7);
q_t q2(7, -3, 0, 1);
wq_t wq1(q1, q2);
std::cout << q0 << ", " << q1 << ", " << q2 << " -> " << fnma(q0, q1, q2) << "\n";
std::cout << q0 << ", " << q0 << ", " << q2 << " -> " << fnma(q0, q0, q2) << "\n";
std::cout << "Mixed: "<< "\n";
std::cout << c0 << ", " << q1 << ", " << e2 << " -> " << kyosu::fnma(c0, q1, e2) << std::endl;
std::cout << e0 << ", " << q1 << ", " << q2 << " -> " << kyosu::fnma(e0, q1, q2) << std::endl;
std::cout << c0 << ", " << wq1<< ", " << e2 << " -> " << kyosu::fnma(c0, we1, q2) << std::endl;
std::cout << we0<< ", " << q1 << ", " << e2 << " -> " << kyosu::fnma(we0, q1, e2) << std::endl;
return 0;
}
as_cayley_dickson_n_t< 4, T > quaternion_t
Type alias for quaternion numbers.
Definition: quaternion.hpp:27
as_cayley_dickson_n_t< 2, T > complex_t
Type alias for complex numbers.
Definition: complex.hpp:27