- simd[meta header]
- std::simd[meta namespace]
- function template[meta id-type]
- cpp26[meta cpp]
namespace std::simd {
template<math-floating-point V>
constexpr deduced-vec-t<V>
remquo(const V& x, const V& y,
rebind_t<int, deduced-vec-t<V>>* quo); // (1) C++26
template<math-floating-point V>
constexpr deduced-vec-t<V>
remquo(const deduced-vec-t<V>& x, const V& y,
rebind_t<int, deduced-vec-t<V>>* quo); // (2) C++26
template<math-floating-point V>
constexpr deduced-vec-t<V>
remquo(const V& x, const deduced-vec-t<V>& y,
rebind_t<int, deduced-vec-t<V>>* quo); // (3) C++26
}- deduced-vec-t[link /reference/simd/deduced-vec-t.md]
- math-floating-point[link /reference/simd/math-floating-point.md]
- rebind_t[link rebind.md]
basic_vecの各要素について、remainderと同じIEEE剰余を求めると同時に、商x / yの下位ビット(符号付き)を*quoに格納する。
制約math-floating-pointは、Vが浮動小数点要素のbasic_vec、またはそこからbasic_vecを導出可能なスカラー浮動小数点型であることを表す説明専用のコンセプトである。deduced-vec-t<V>は、Vに対応するbasic_vec型(Vがスカラー型のときはそれを要素型とするbasic_vec)を表す。
- (1) : 両引数が同じ型
Vの場合。 - (2), (3) : 一方の引数を
basic_vec、他方をスカラー値として、スカラー側を全要素に対して適用する場合。
各要素iについて、x・yの対応する要素に<cmath>のremquoを適用したときの商側の結果で初期化されたrebind_t<int, deduced-vec-t<V>>型のオブジェクトを*quoに格納する。
各要素iについて、x・yの対応する要素に<cmath>のremquoを適用したときの剰余で初期化されたdeduced-vec-t<V>型のオブジェクトを返す。
ある要素iについて定義域エラー・極エラー・値域エラーが発生する場合、その要素の値は未規定である。
errnoにアクセスするか否かは未規定である。
#include <simd>
#include <print>
namespace simd = std::simd;
int main()
{
simd::vec<float, 4> x{[](int i) { constexpr float a[] = {5, 7, 9, 11}; return a[i]; }};
simd::rebind_t<int, simd::vec<float, 4>> quo;
// 各要素の3.0に対するIEEE剰余と、商の下位ビットを求める
simd::vec<float, 4> r = simd::remquo(x, 3.0f, &quo);
for (int i = 0; i < r.size(); ++i)
std::print("{}(quo={}) ", r[i], quo[i]);
std::println("");
}- simd::remquo[color ff0000]
- simd::vec[link basic_vec.md]
- simd::rebind_t[link rebind.md]
-1(quo=2) 1(quo=2) 0(quo=3) -1(quo=4)
- C++26
- Clang: 22 [mark noimpl]
- GCC: 16.1 [mark noimpl]
- Visual C++: 2026 Update 2 [mark noimpl]
- P1928R15 std::simd — merge data-parallel types from the Parallelism TS 2
- C++26で追加された
- P3844R4 Reword simd.math for consteval conversions
<cmath>関数と同様に引数の変換を呼び出し側で行うよう、<simd>の数学関数が複数のオーバーロードとして再規定された(比較関数の戻り値型の修正・不足していたオーバーロードの追加を含む)