E.V.E
v2023.02.15

◆ prime_ceil

eve::prime_ceil = {}
inlineconstexpr

Returns the smallest prime greater or equal to the input.

Defined in Header

#include <eve/module/combinatorial.hpp>

Callable Signatures

namespace eve
{
template< eve::unsigned_value N >
N prime_ceil(N n) noexcept;
}
constexpr callable_prime_ceil_ prime_ceil
Returns the smallest prime greater or equal to the input.
Definition: prime_ceil.hpp:68
Definition: abi.hpp:18

Parameters

  • n : unsigned argument. If n is greater than 104'729, behavior is undefined.

Return value The smallest prime greater or equal to n. The result type is the same as the input one unless a converter is applied (see below).

Example

#include <eve/module/combinatorial.hpp>
#include <eve/wide.hpp>
#include <iomanip>
#include <iostream>
int
main()
{
w32_t pi32 = {0, 6, 6542, 15, 104729, 104730, 10000, 1000};
std::cout << "---- simd" << '\n'
<< " <- pi32 = " << pi32 << '\n'
<< " -> prime_ceil(pi32) = " << eve::prime_ceil(pi32)
<< " // note 0 meaning out of implemented range\n";
std::uint32_t xi = 18;
std::cout << "---- scalar" << '\n'
<< " xi = " << xi << '\n'
<< " -> prime_ceil(xi) = " << eve::prime_ceil(xi) << '\n';
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65

Semantic Modifiers

  • Optimized Conversion Call

    The converters eve::float_, eve::double_, eve::floating_ can be applied to produce a floating point output.

    Example

    #include <eve/module/combinatorial.hpp>
    #include <eve/wide.hpp>
    #include <iomanip>
    #include <iostream>
    int
    main()
    {
    w32_t pi32 = {0, 6, 6542, 15, 104729, 104730, 10000, 1000};
    std::cout << "---- simd" << '\n'
    << " <- pi32 = " << pi32 << '\n'
    << " -> float32(prime_ceil)(pi32) = " << eve::float32(eve::prime_ceil)(pi32)
    << " // note nan meaning out of implemented range\n";
    return 0;
    }
    constexpr converter_type< float > const float32
    convert a eve::value to a float32 based eve::floating_value.
    Definition: converter.hpp:130