# How to use 96 bits floats?

**URL:** <https://discourse.julialang.org/t/how-to-use-96-bits-floats/78155>\
**Category:** General Usage\
**Tags:** question\
**Created:** [March 20, 2022, 5:56am UTC](https://discourse.julialang.org/t/how-to-use-96-bits-floats/78155 "2022-03-20T05:56:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaulDurand](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rauldurand/32/2044_2.png) [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Post date:** [March 20, 2022, 5:56am UTC](https://discourse.julialang.org/t/how-to-use-96-bits-floats/78155/1 "2022-03-20T05:56:51Z")

</div>

I am solving some linear systems with ill-conditioned sparse matrices. Using Float64 sometimes the solver returns “Singular matrix”.  
I would like to increase the number of bits for the floating-point numbers in the sparse matrix.  
How can I get 96 bits floats in Julia? Is there any other option?

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [March 20, 2022, 6:01am UTC](https://discourse.julialang.org/t/how-to-use-96-bits-floats/78155/2 "2022-03-20T06:01:24Z")

</div>

Try the built-in type `BigFloat` or perhaps DoubleFloats.jl  
You might need to load GenericLinearAlgebra.jl for the algebra routines to accept the number types.

---

<div class="post-metadata">

**Author:** ![photor](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/photor/32/14343_2.png) [@photor](https://discourse.julialang.org/u/photor)\
**Post date:** [March 20, 2022, 8:43am UTC](https://discourse.julialang.org/t/how-to-use-96-bits-floats/78155/3 "2022-03-20T08:43:13Z")

</div>

As mentioned above, DoubleFloats.jl may be a good option, but it is still much slower (about an order of magnitude) than the built-in Float64.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [March 20, 2022, 9:04am UTC](https://discourse.julialang.org/t/how-to-use-96-bits-floats/78155/4 "2022-03-20T09:04:44Z")

</div>

doublefloats should generally only be 3-10x slower. that said, there are a few cases where it is currently worse than that.

---

<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:** [March 20, 2022, 12:29pm UTC](https://discourse.julialang.org/t/how-to-use-96-bits-floats/78155/5 "2022-03-20T12:29:01Z")

</div>

> [@RaulDurand](#):
>
> I am solving some linear systems with ill-conditioned sparse matrices.

Note that increasing the precision is rarely a good solution for ill-conditioning. (If your matrices are ill-conditioned, then you typically have vastly increased sensitivity to _any_ form of error in your problem, including modeling error. Even if you get _an_ answer by increasing the precision, that doesn’t mean the answer is meaningful. Or if you have a catastrophic cancellation, you might simply need vastly increased precision to work around it.)

Often, you need to re-think how you are formulating the problem.
