# \[ANN\] Quadmath.jl

**URL:** https://discourse.julialang.org/t/ann-quadmath-jl/23015
**Category:** Package Announcements
**Created:** [April 10, 2019, 9:46pm UTC](https://discourse.julialang.org/t/ann-quadmath-jl/23015 "2019-04-10T21:46:46Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![simonbyrne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simonbyrne/32/19_2.png) [@simonbyrne](https://discourse.julialang.org/u/simonbyrne)
#### Post date: [April 10, 2019, 9:46pm UTC](https://discourse.julialang.org/t/ann-quadmath-jl/23015/1 "2019-04-10T21:46:46Z")

</div>

I’ve recently tagged a v0.3 of [Quadmath.jl](https://github.com/JuliaMath/Quadmath.jl): this provides a `Float128` type which implements IEEE 128-bit floating point numbers, and runs on Windows, Linux and MacOS.

These offer higher-precision than hardware-supported floats (`Float32`/`Float64`), but should be faster than arbitrary-precision `BigFloat`s.

---

<div class="post-metadata">

### Author: ![greg\_plowman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/greg_plowman/32/8100_2.png) [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)
#### Post date: [April 10, 2019, 10:03pm UTC](https://discourse.julialang.org/t/ann-quadmath-jl/23015/2 "2019-04-10T22:03:34Z")

</div>

Could you give a comparison to `DoubleFloats`?

---

<div class="post-metadata">

### Author: ![simonbyrne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simonbyrne/32/19_2.png) [@simonbyrne](https://discourse.julialang.org/u/simonbyrne)
#### Post date: [April 10, 2019, 10:10pm UTC](https://discourse.julialang.org/t/ann-quadmath-jl/23015/3 "2019-04-10T22:10:47Z")

</div>

It should have marginally better precision and a much greater exponent range than `DoubleFloats`. I suspect the performance would be worse, but haven’t compared them.

---

<div class="post-metadata">

### Author: ![chrisvwx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisvwx/32/45289_2.png) [@chrisvwx](https://discourse.julialang.org/u/chrisvwx)
#### Post date: [May 2, 2019, 10:54pm UTC](https://discourse.julialang.org/t/ann-quadmath-jl/23015/4 "2019-05-02T22:54:42Z")

</div>

The second image in the [LLLplus.jl](https://github.com/christianpeel/LLLplus.jl) README shows a speed comparison between LLL decomposition of 128x128 matrices of `Float128` and `Double64` (from DoubleFloat.jl). In this case they have similar speed.

---

<div class="post-metadata">

### Author: ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)
#### Post date: [May 2, 2019, 11:18pm UTC](https://discourse.julialang.org/t/ann-quadmath-jl/23015/5 "2019-05-02T23:18:23Z")

</div>

For `+, *, exp, sin`, using `@btime +(Ref($x)[], Ref($y)[])` etc, I get DoubleFloats faster by (ratios) 3.8x, 6.8x, 1.7x, 1.6x. [just one machine] Of course, Quadmath offers 32ish bits more precision and many more exponents.

For multiplying 128x128 matrices, 3.7x (@btime Float128 / @btime Double64)

---

<div class="post-metadata">

### Author: ![Ralph\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralph_smith/32/10344_2.png) [@Ralph\_Smith](https://discourse.julialang.org/u/Ralph_Smith)
#### Post date: [May 3, 2019, 2:45am UTC](https://discourse.julialang.org/t/ann-quadmath-jl/23015/6 "2019-05-03T02:45:11Z")

</div>

With single-threaded SIMD, one can get about 13x Float128/Double64 for 128x128 GEMM. (You should be confident of avoiding overflow to use this for real work.) Proof of concept at [DoubleBLAS.jl](https://github.com/RalphAS/DoubleBLAS.jl), with multithreaded versions approaching 30x Double64/Float64.

---

<div class="post-metadata">

### Author: ![chrisvwx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisvwx/32/45289_2.png) [@chrisvwx](https://discourse.julialang.org/u/chrisvwx)
#### Post date: [May 21, 2019, 7:18am UTC](https://discourse.julialang.org/t/ann-quadmath-jl/23015/7 "2019-05-21T07:18:07Z")

</div>

It looks to me like DoubleFloat.jl has been updated and is much faster now on many linear algebra tasks like ‘qr’:

```julia
using LinearAlgebra
using DoubleFloats
using Quadmath
using BenchmarkTools
N = 50;
F64 = randn(N,N);
F128 = Float128.(F64);
D64 = Double64.(F64);
Big = BigFloat.(F64);
@belapsed qr($F128) # 0.00342
@belapsed qr($D64) # 0.000920
@belapsed qr($Big) # 0.0103

```
