# Optimizing sums of products (dot products)

**URL:** <https://discourse.julialang.org/t/optimizing-sums-of-products-dot-products/119515>\
**Category:** Performance\
**Tags:** simd, linearalgebra, sum\
**Created:** [September 17, 2024, 4:40pm UTC](https://discourse.julialang.org/t/optimizing-sums-of-products-dot-products/119515 "2024-09-17T16:40:15Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [September 18, 2024, 1:27am UTC](https://discourse.julialang.org/t/optimizing-sums-of-products-dot-products/119515/7 "2024-09-18T01:27:02Z")

</div>

In the extreme, you can get _nearly any floating point value_ just by choosing different orderings when summing [this one list of 2046 floats](https://discourse.julialang.org/t/array-ordering-and-naive-summation/1929).

These “ffast” or “funsafe” flags just make programs impossible to reason about. It frequently means you get different answers for the same operation, causing all sorts of surprises and broken invariants. `x` might equal `y` in one context but be less than it in another.

@simonbyrne has a good writeup here:

[https://simonbyrne.github.io/notes/fastmath/](https://simonbyrne.github.io/notes/fastmath/)

---

_[View the full topic](https://discourse.julialang.org/t/optimizing-sums-of-products-dot-products/119515)._
