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

◆ is_nan

kyosu::is_nan = eve::functor<is_nan_t>
inlineconstexpr

test the parameter for nan

Header file

#include <kyosu/functions.hpp>

Callable Signatures

namespace kyosu
{
template<kyosu::concepts::cayley_dickson T> constexpr auto is_nan(T z) noexcept;
template<eve::floating_ordered_value T> constexpr auto is_nan(T z) noexcept;
}
constexpr auto is_nan
test the parameter for nan
Definition: is_nan.hpp:61
Main KYOSU namespace.
Definition: cinf.hpp:13

Parameters

  • z: Value to process.

Return value

Returns elementwise true is any component of the element is nan .

Example

#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
using eve::as;
using e_t = float;
using we_t = eve::wide<e_t, eve::fixed<4>>;
using wc_t = eve::wide<c_t, eve::fixed<4>>;
using wq_t = eve::wide<q_t, eve::fixed<4>>;
std::cout << "Real: \n";
e_t e(2.9f);
e_t nan = eve::nan(as(e));
e_t inf = eve::inf(as(e));
e_t zer = eve::zero(as(e));
we_t we = we_t(e, zer, nan, inf);
std::cout << e << " -> " << is_nan(e) << "\n";
std::cout << we << " -> " << is_nan(we) << "\n";
std::cout << is_nan(c_t(e))<< "\n";
std::cout << is_nan(q_t(e))<< "\n";
std::cout << is_nan(kyosu::complex(we))<< "\n";
std::cout << is_nan(kyosu::quaternion(we))<< "\n";
std::cout << "Complex: \n";
c_t c(3.5f,-2.9f);
c_t d(0.0f, inf);
wc_t wc = wc_t(c, zer, nan, d);
std::cout << c << " -> " << is_nan(c) << "\n";
std::cout << wc << " -> " << is_nan(wc) << "\n";
std::cout << is_nan(kyosu::complex(wc))<< "\n";;
std::cout << is_nan(kyosu::quaternion(wc))<< "\n";
std::cout << "Quaternion: \n";
q_t q(3.5f,-2.9f, 2.1f, 3.2f);
q_t r(3.5f, nan, inf, zer);
wq_t wq = wq_t(q, zer, nan, r);
std::cout << q << " -> " << is_nan(q) << "\n";
std::cout << wq << " -> " << is_nan(wq) << "\n";
return 0;
}
constexpr auto complex
Constructs a kyosu::complex_t instance.
Definition: to_complex.hpp:75
constexpr auto quaternion
Constructs a kyosu::quaternion_t instance.
Definition: to_quaternion.hpp:83
as_cayley_dickson_n_t< 4, T > quaternion_t
Type alias for quaternion numbers.
Definition: quaternion.hpp:24
as_cayley_dickson_n_t< 2, T > complex_t
Type alias for complex numbers.
Definition: complex.hpp:27