
Double-double: 31 digits of precision without leaving the FPU
If you ever need more precision than what 15 decimal digits of the double format can offer, and arbitrary-precision arithmetic is too slow, too heavy, or simply not available, there is a neat trick: glue two doubles together and treat them as one number. This gives you ~31 decimal digits for roughly 9x the cost of a plain double in a real kernel (4-12x per isolated operation), with no heap allocation and no dependencies, which lands it almost exactly halfway between a double and a real arbitrary-precision library. This post explains the error-free transformations that make it work, measures it against MPFR, and shows where the trick runs out of steam.

















