E.V.E
v2023.02.15
Loading...
Searching...
No Matches
◆
prime_floor
auto eve::prime_floor =
functor
<prime_floor_t>
inline
constexpr
Header file
#include <eve/module/combinatorial.hpp>
Callable Signatures
namespace
eve
{
constexpr
auto
prime_floor
(
unsigned_value
auto
x) ->
decltype
(x)
noexcept
;
//1
template
<
int
egral_value T,
float
ing_scalar_value U>
constexpr
as_wide_as_t<U, T>
prime_floor
(T x,
as<U>
)
noexcept
;
//2
template
<
int
egral_value T,
unsigned
_scalar_value U>
constexpr
as_wide_as_t<U, T>
prime_floor
(T x,
as<U>
)
noexcept
;
//2
}
eve::unsigned_value
The concept unsigned_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition
value.hpp:84
eve::prime_floor
constexpr auto prime_floor
strict_elementwise_callable object computing the greatest prime less or equal to the input.
Definition
prime_floor.hpp:80
eve
EVE Main Namespace.
Definition
abi.hpp:18
eve::as
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
The greatest prime less or equal to
n
.
Same, but the element of the result type is deduced from U.
External references
Wikipedia: Prime number
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"
;
}
eve::wide
Wrapper for SIMD registers.
Definition
wide.hpp:70
eve