# Question about floating-point precision in summation

**URL:** <https://discourse.julialang.org/t/question-about-floating-point-precision-in-summation/58334>\
**Category:** Performance\
**Tags:** question, package\
**Created:** [March 31, 2021, 10:29pm UTC](https://discourse.julialang.org/t/question-about-floating-point-precision-in-summation/58334 "2021-03-31T22:29:59Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![Frisus95](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@Frisus95](https://discourse.julialang.org/u/Frisus95)\
**Post date:** [April 2, 2021, 3:40pm UTC](https://discourse.julialang.org/t/question-about-floating-point-precision-in-summation/58334/22 "2021-04-02T15:40:12Z")

</div>

Yes, in fact I was inaccurate: the problem did not stem from the fact that the numbers are small, but from the fact that I must necessarily multiply and add up an enormous quantity of numbers that can differ from each other by many orders of magnitude. I suspect that this was the cause of the discrepancy of some results that I observed, while now this discrepancy has clearly disappeared with the BigFloats, which (although they are probably not the best existing solutions in terms of precision and efficiency) for the moment are more than enough to effectively solve the problem. For any future needs I will definitely come back to consult this topic, since extremely interesting discussions have arisen.

I am very happy that there are forums like these!

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [April 2, 2021, 8:36pm UTC](https://discourse.julialang.org/t/question-about-floating-point-precision-in-summation/58334/23 "2021-04-02T20:36:16Z")

</div>

By the way, I was corresponding today with Radford Neal (author of the xsum algorithm), and he asked

> Our of curiosity, what applications do Julia people tend to use xsum for?

If anyone has applications that they want to share where they wanted/needed extended-precision sums, I would love to pass them along.

e.g. @Frisus95, could you say what application your problem arises in?

---

<div class="post-metadata">

**Author:** ![Frisus95](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@Frisus95](https://discourse.julialang.org/u/Frisus95)\
**Post date:** [April 2, 2021, 9:00pm UTC](https://discourse.julialang.org/t/question-about-floating-point-precision-in-summation/58334/24 "2021-04-02T21:00:13Z")

</div>

It is a calculation that has to do with quantum gravity. The theory I’m working on is called “loop quantum gravity”, founded by Peter Smolin, Abhay Ashtekar and Carlo Rovelli (someone here has probably heard of it). In a nutshell, we are trying to unify quantum mechanics and general relativity.

[Previous page](https://discourse.julialang.org/t/question-about-floating-point-precision-in-summation/58334.md?page=1)
