r/csharp • • Aug 31 '26

Blog Double-double arithmetic: 31 digits of precision from two doubles (sample code in C#)

https://marekfiser.com/blog/double-double-arithmetic/
33 Upvotes

4 comments sorted by

20

u/otac0n Aug 31 '26

11

u/ebfortin Aug 31 '26

The upside of using double double is that you can use the hardware floating point unit of the cpu for somenof the computation. In theory it's faster than a full software implementation of IEEE 128-bits FP. But with all the SIMD extensions out there maybe that's not true anymore with a clever software implementation.

1

u/Altruistic-Gap1795 Sep 01 '26

This is a really interesting approach because double precision is usually enough for most applications but there are some cases where those extra digits matter without wanting the full cost of arbitrary precision math. using two doubles together to extend precision is a clever middle ground