
On 20/12/12 14:49, Thorsten Ottosen wrote:
Sure, the 80 bits are one reason that a naive sum is often as precise as a kahan sum on x87.
Let me ask another way: compilers often provide flags that affect how code is generate for fp. For example, we use fp:precise on VS. Do fp:precise affect SIMD code or?
fp:precise is the normal operating mode for floating-point, i.e. the compiler is not allowed to do optimizations that would break your code. This is the only mode in which we guarantee the numerical accuracy of our results. (we usually guarantee 1 ulp) fp:fast considers that floating-point operations are associative, among others, which enables more transformations on your code and possible optimizations or automatic parallelizations (parallelization may require changing the order of operations). Since floating-point operations are not really associative, you could end up with different results (e.g. a kahan sum will be considered equivalent to a normal sum). Boost.SIMD can also be used in this mode, but whether the compiler will be able to use it with vector intrinsics and not just scalars depends on how good it is.