https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77776

--- Comment #9 from Matthias Kretz <kretz at kde dot org> ---
(In reply to emsr from comment #7)
> What does this do?
> 
>   auto __hi_exp =
>     __hi & simd<_T, _Abi>(std::numeric_limits<_T>::infinity()); // no error

component-wise bitwise and of __hi and +inf. Or in other words, it sets all
sign bits and mantissa bits to 0. Consequently `__hi / __hi_exp` returns __hi
with the exponent bits set to 0x3f8 (float) / 0x3ff (double) and the mantissa
bits unchanged.

> Sorry, I have no simd knowlege yet.

It's a very simple idea:
- simd<T> holds simd<T>::size() many values of type T.
- All operators/operations act component-wise.

See Section 9 in wg21.link/N4793 for the last WD of the TS.

> Anyway, doesn't the large scale risk overflow if a, b are large? I guess I'm
> lost.

It basically has the same underflow risks as your implementation does, and no
risk of overflow.

Reply via email to