E.V.E
v2023.02.15
 
Loading...
Searching...
No Matches

◆ nan

auto eve::nan = functor<nan_t>
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr T nan(as<T> x) noexcept;
}
constexpr auto nan
Computes the IEEE quiet NaN constant.
Definition nan.hpp:67
EVE Main Namespace.
Definition abi.hpp:18
Lightweight type-wrapper.
Definition as.hpp:29

Parameters

  • x : Type wrapper instance embedding the type of the constant.

Return value

The call eve::nan(as<T>()) is semantically equivalent to T(0.0/0.0).

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_nan() { return eve::nan(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> nan(as<wide_ft>()) = " << eve::nan(eve::as<wide_ft>()) << std::endl
<< "-> nan(as(wxf)) = " << eve::nan(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> nan(as<float>()) = " << eve::nan(eve::as(float())) << std::endl
<< "-> nan(as<xf)) = " << eve::nan(eve::as(xf)) << std::endl;
std::cout << "-> constexpr nan = " << constexpr_nan<float>() << std::endl;
return 0;
}
Wrapper for SIMD registers.
Definition wide.hpp:70