# Using Float128 in RandomMatrices

**URL:** <https://discourse.julialang.org/t/using-float128-in-randommatrices/75921>\
**Category:** New to Julia\
**Tags:** package\
**Created:** [February 6, 2022, 10:07pm UTC](https://discourse.julialang.org/t/using-float128-in-randommatrices/75921 "2022-02-06T22:07:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jisutich](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jisutich/32/33342_2.png) [@jisutich](https://discourse.julialang.org/u/jisutich)\
**Post date:** [February 6, 2022, 10:07pm UTC](https://discourse.julialang.org/t/using-float128-in-randommatrices/75921/1 "2022-02-06T22:07:13Z")

</div>

Hi guys:

I am using the package RandomMatrices to generate Haar random unitary matrices. But recently I want to generate unitary matrices with higher precision. So I found the package Quadmath which provides Float128 object. But how to combines these two packages together? How to generate a Haar random unitary matrix with Float128? By the way, is there a way to use things like randn(Float128,(N,N))? It seems that this doesn’t work for Float128 in Quadmath

---

<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:** [February 6, 2022, 10:19pm UTC](https://discourse.julialang.org/t/using-float128-in-randommatrices/75921/2 "2022-02-06T22:19:52Z")

</div>

I’m not sure if `Quadmath` has the necessary support, but you can do this with `DoubleFloats` (which give you roughly 100 bits of precision and are usually about 2x faster).

```julia
julia> using DoubleFloats
julia> randn(Double64, 10, 10)
10×10 Matrix{Double64}:
...

```

---

<div class="post-metadata">

**Author:** ![jisutich](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jisutich/32/33342_2.png) [@jisutich](https://discourse.julialang.org/u/jisutich)\
**Post date:** [February 6, 2022, 11:15pm UTC](https://discourse.julialang.org/t/using-float128-in-randommatrices/75921/3 "2022-02-06T23:15:03Z")

</div>

Thanks this sounds good.
