# And Julia keeps amazing me: high precision computation

**URL:** <https://discourse.julialang.org/t/and-julia-keeps-amazing-me-high-precision-computation/107740>\
**Category:** Community\
**Tags:** precision, bigfloat\
**Created:** [December 17, 2023, 5:21pm UTC](https://discourse.julialang.org/t/and-julia-keeps-amazing-me-high-precision-computation/107740 "2023-12-17T17:21:15Z")\
**Posts on this page:** 1\
**Showing post:** 6

<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:** [December 18, 2023, 2:51pm UTC](https://discourse.julialang.org/t/and-julia-keeps-amazing-me-high-precision-computation/107740/6 "2023-12-18T14:51:03Z")

</div>

> [@Ronis\_BR](#):
>
> The problem is when you try using very high degrees, leading to 300! and so on. I was thinking how I could possible handle this problem, like interactively computing the terms using a nice “guess” to always divide things to reach lower numbers.

In series expressions like this, you should almost never call the `factorial` function, nor should you compute the powers for each term separately. Instead, compute each term iteratively from the previous term, starting with the smallest power and the smallest factorial. Not only is this computationally cheaper, but it also allows you to circumvent spurious over/underflow and avoid having to use expensive arbitrary-precision arithmetic.

This is something that many people forget. See, for example:

- [Special functions , associated Legendre type 3 - #5 by stevengj](https://discourse.julialang.org/t/special-functions-associated-legendre-type-3/2163/5)
- [Sinc function - and sinc neural networks - and function approximation for the former - #4 by stevengj](https://discourse.julialang.org/t/sinc-function-and-sinc-neural-networks-and-function-approximation-for-the-former/46483/4)

---

_[View the full topic](https://discourse.julialang.org/t/and-julia-keeps-amazing-me-high-precision-computation/107740)._
