Get the latest tech news

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, 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, this puts it almost exactly halfway between a double and an arbitrary-precision library perf-wise. This post explains the error-free transformations that make it work, measures it against MPFR, and shows where the trick runs out of steam.

None

Get the Android app

Or read this on Hacker News

Read more on:

Photo of precision

precision

Photo of digits

digits

Photo of fpu

fpu

Related news:

News photo

Anti-drone chain gun with 50mm precision-guided ammunition unveiled — Northrop Grumman's Raid Hunter is designed to wipe out drone swarms and cruise missiles

News photo

Just Let Me Write Digits

News photo

Using precision editing to study human embryo development shows master gene