◆ nth_prime
Callable object performing the computation the nth prime integer. Required header: Members Functions
template< unsigned_value T > auto operator()( T n ) const noexcept;
Parameters
Return value The result element type is the same as the input one unless a converter is applied to Almost no computations are made, the results are from a lookup table. 2 is the first prime number (n=0). If the output is of integral type incorrect computation will return 0, but if the result has been converted to a floating value (by concerting the object function) incorrect computation will return nan
Supported decoratorsno decorators are supported ExampleSee it live on Compiler Explorer #include <eve/function/nth_prime.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
using w16_t = eve::wide<std::uint32_t, eve::fixed<8>>;
w16_t pi16 = {52, 53, 6541, 6542, 0, 1, 999, 10000};
std::cout << "---- simd" << '\n'
<< " <- pi16 = " << pi16 << '\n'
<< " -> float32(nth_prime(pi16)) = " << eve::float32(eve::nth_prime(pi16)) << "// mind the parentheses\n\n";
std::uint16_t xi = 18;
std::cout << "---- scalar" << '\n'
<< " xi = " << xi << '\n'
return 0;
}
constexpr callable_nth_prime_ nth_prime Callable object performing the computation the nth prime integer. Definition: nth_prime.hpp:70 constexpr converter_type< std::uint32_t > const uint32 convert a eve::real_value to a uint32 based eve::integral_real_value. Definition: converter.hpp:229 constexpr converter_type< float > const float32 convert a eve::real_value to a float32 based eve::floating_real_value. Definition: converter.hpp:133 |