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

◆ nbmantissabits

auto eve::nbmantissabits = functor<nbmantissabits_t>
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr T nbmantissabits(as<T> x) noexcept;
}
constexpr auto nbmantissabits
Returns the number of mantissa bits of a floating point value.
Definition nbmantissabits.hpp:70
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::nbmantissabits(as<T>()) is semantically equivalent to:

  • as_integer_t<T>(23) if eve::element_type_t<T> is float
  • as_integer_t<T>(52) if eve::element_type_t<T> is double

Example

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