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

◆ prime_floor

auto eve::prime_floor = functor<prime_floor_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, or less than 2 returns 0.

Return value

  1. The greatest prime less or equal to n.
  2. Same, but the element of the result type 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{2u, 6u, 6542u, 15u, 1u, 200000u, 10000u, 1000u};
int main(){
std::cout << "<- wu = " << wu << "\n";
std::cout << "<- n = " << n << "\n";
std::cout << "-> prime_floor(wu)= " << eve::prime_floor(wu) << "\n";
std::cout << "-> prime_floor(n) = " << eve::prime_floor(n) << "\n";
std::cout << "note 0 answer meaning 'out of implemented range'\n";
}
Wrapper for SIMD registers.
Definition wide.hpp:70