diff options
author | Antonio Sanchez <cantonios@google.com> | 2021-03-03 19:22:15 -0800 |
---|---|---|
committer | Antonio Sanchez <cantonios@google.com> | 2021-03-05 08:54:12 -0800 |
commit | 82d61af3a490154ad1c0ae2fe00c561095854897 (patch) | |
tree | 9137169da76e43ef4908ab87dc5990d801c48eda /doc/examples/tut_arithmetic_scalar_mul_div.cpp | |
parent | 5f0b4a4010af4cbf6161a0d1a03a747addc44a5d (diff) |
Fix rint SSE/NEON again, using optimization barrier.
This is a new version of !423, which failed for MSVC.
Defined `EIGEN_OPTIMIZATION_BARRIER(X)` that uses inline assembly to
prevent operations involving `X` from crossing that barrier. Should
work on most `GNUC` compatible compilers (MSVC doesn't seem to need
this). This is a modified version adapted from what was used in
`psincos_float` and tested on more platforms
(see #1674, https://godbolt.org/z/73ezTG).
Modified `rint` to use the barrier to prevent the add/subtract rounding
trick from being optimized away.
Also fixed an edge case for large inputs that get bumped up a power of two
and ends up rounding away more than just the fractional part. If we are
over `2^digits` then just return the input. This edge case was missed in
the test since the test was comparing approximate equality, which was still
satisfied. Adding a strict equality option catches it.
Diffstat (limited to 'doc/examples/tut_arithmetic_scalar_mul_div.cpp')
0 files changed, 0 insertions, 0 deletions