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

◆ rem

auto eve::rem = functor<rem_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto rem(value auto x, value auto y) noexcept; // 1
// Lanes masking
constexpr auto rem[conditional_expr auto c](value auto x, value auto y) noexcept; // 2
constexpr auto rem[logical_value auto m](value auto x, value auto y) noexcept; // 2
// Semantic option
constexpr auto rem[downward](/*any of the above overloads*/) noexcept; // 3
constexpr auto rem[upward](/*any of the above overloads*/) noexcept; // 3
constexpr auto rem[to_nearest](/*any of the above overloads*/) noexcept; // 3
constexpr auto rem[toward_zero](/*any of the above overloads*/) noexcept; // 3
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:132
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition value.hpp:34
constexpr auto rem
elementwise_callable object computing the remainder after division.
Definition rem.hpp:85
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value

  1. Return the remainder after division of x by y and is equivalent to x-div[toward_zero](x, y)*y.
  2. The operation is performed conditionnaly.
  3. The call is equivalent to x-div[o](x, y)*y where o is the chosen option. For unsigned integral the options upward and nearest are undefined behaviour as the result could be negative.
Note
Although the infix notation with % is supported, the % operator on standard integral scalar type is the original one and so can lead to automatic promotion. Moreover due to C++ limitations, % is not available for scalar floating point values.

Example

// revision 1
#include <eve/module/core.hpp>
#include <iostream>
int main()
{
w_t pi = {3, 2, 3, 32700}, qi = {4, 2, 1, 101}, ri = {4, 2, 0, 101};
std::cout << " <- pi = " << pi << '\n'
<< " <- qi = " << qi << '\n'
<< " <- ri = " << ri << '\n'
<< " -> rem(pi, qi) = " << eve::rem(pi, qi) << '\n'
<< " -> rem[toward_zero](pi, qi) = " << eve::rem[eve::toward_zero](pi, qi) << '\n'
<< " -> rem[downward](pi, qi) = " << eve::rem[eve::downward](pi, qi) << '\n'
<< " -> rem[upward](pi, qi) = " << eve::rem[eve::upward](pi, qi) << '\n'
<< " -> rem[toward_zero](pi, qi) = " << eve::rem[eve::to_nearest](pi, qi) << '\n'
<< " -> pi % qi = " << pi % qi << '\n';
}
constexpr auto pi
Callable object computing the constant .
Definition pi.hpp:77
Wrapper for SIMD registers.
Definition wide.hpp:70