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

◆ sqrtvalmax

auto eve::sqrtvalmax = functor<sqrtvalmax_t>
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plain_value T> constexpr T sqrtvalmax(as<T> x) noexcept;
}
constexpr auto sqrtvalmax
Computes the the greatest value less than the square root of eve::valmax.
Definition sqrtvalmax.hpp:74
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::sqrtvalmax(as<T>()) is the greatest number of the type whose square is less or equal to eve::valmax(as<T>()).

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
template<typename T>
consteval auto constexpr_sqrtvalmax() { return eve::sqrtvalmax(eve::as<T>{}); }
int main()
{
wide_ft x;
wide_it y;
std::cout << "---- simd" << '\n'
<< "-> sqrtvalmax(as<wide_ft>() = " << eve::sqrtvalmax(eve::as<wide_ft>()) << '\n'
<< "-> sqrtvalmax(as<wide_it>() = " << eve::sqrtvalmax(eve::as<wide_it>()) << '\n'
<< "-> sqrtvalmax(as(x)) = " << eve::sqrtvalmax(eve::as(x)) << '\n'
<< "-> sqrtvalmax(as(y)) = " << eve::sqrtvalmax(eve::as(y)) << '\n';
float xf;
std::int16_t xi;
std::cout << "---- scalar" << '\n'
<< "-> sqrtvalmax(as<float>() = " << eve::sqrtvalmax(eve::as<float>()) << '\n'
<< "-> sqrtvalmax(as<std::int16_t>() = " << eve::sqrtvalmax(eve::as<std::int16_t>()) << '\n'
<< "-> sqrtvalmax(as(xf)) = " << eve::sqrtvalmax(eve::as(xf)) << '\n'
<< "-> sqrtvalmax(as(xi)) = " << eve::sqrtvalmax(eve::as(xi)) << '\n';
std::cout << "-> constexpr sqrtvalmax = " << constexpr_sqrtvalmax<float>() << std::endl;
return 0;
}
Wrapper for SIMD registers.
Definition wide.hpp:70