r/csharp 3d ago

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

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

4 comments sorted by

20

u/otac0n 3d ago

8

u/ebfortin 3d ago

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 2d ago

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