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

◆ prime_ceil

auto eve::prime_ceil = functor<prime_ceil_t>
inlineconstexpr

Header file

#include <eve/module/combinatorial.hpp>

Callable Signatures

namespace eve
{
constexpr auto prime_floor(unsigned_value auto x) -> decltype(x) noexcept; //1
template < integral_value T, floating_scalar_value U>
constexpr as_wide_as_t<U, T> prime_floor(T x, as<U>) noexcept; //2
template < integral_value T, unsigned_scalar_value U>
constexpr as_wide_as_t<U, T> prime_floor(T x, as<U>) noexcept; //2
}
The concept unsigned_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:84
constexpr auto prime_floor
strict_elementwise_callable object computing the greatest prime less or equal to the input.
Definition prime_floor.hpp:80
EVE Main Namespace.
Definition abi.hpp:18
Lightweight type-wrapper.
Definition as.hpp:29

Parameters

  • n: unsigned argument. If n is greater than 104'729, returns 0.

Return value

  1. The smallest prime greater or equal to n.
  2. Same, but the element type of the result is deduced from U.

External references

Example

// revision 1
#include <eve/module/combinatorial.hpp>
#include <iostream>
eve::wide<std::uint32_t> wu([](auto i, auto )->std::uint32_t{ return i;});
eve::wide n{0u, 6u, 6542u, 15u, 104729u, 104730u, 10000u, 1000u};
int main(){
std::cout << "<- wu = " << wu << "\n";
std::cout << "<- n = " << n << "\n";
std::cout << "-> prime_ceil(wu)= " << eve::prime_ceil(wu) << "\n";
std::cout << "-> prime_ceil(n) = " << eve::prime_ceil(n) << "\n";
std::cout << "note 0 answer meaning 'out of implemented range'\n";
}
constexpr auto prime_ceil
strict_elementwise_callable object computing the smallest prime greater or equal to the input.
Definition prime_ceil.hpp:80
Wrapper for SIMD registers.
Definition wide.hpp:70