Package Exports
- double.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (double.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
double.js
Floating point expansions with 31 accurate decimal digits, also known as double-double arithmetic. This library can be useful for numerically unstable algorithms like finding the correct differentials, inverting matrix, performing triangulation, polygon clipping. Also it is extremely helpful when you need fast computation with extended precision.
Algorithm
Number stored as unevaluated sum of two javascript float numbers and uses error-free arithmetic algorithms from references below. This brings accuracy and significant increase in performance in comparison to digit-wise approach, because this float arithmetic is implemented in hardware. Note that there are no theoretical limitations to javascript language since ECMAScript version 1 uses 64 bit IEEE 754 with round-to-nearest-even after each operations.
Usage
Include double.iife.js script to webpage or install npm package. Most of all functions have static and instance methods. Instance methods more handy. Static methods are faster but you need to control memory allocation by yourself. Result of static methods always returned in first variable, that's why they mutate it. If you want to avoid mutation you need to clone it before usage. Details you can find in wiki page. Also you can play with library in sandbox.
Current status
All presented operations are stable but mult21/div21 and parseDouble/toString not properly accurate with back and forth operation. Anyway it works. Give me feedback if you think that this library is useful.
Benchmark

References
- Theodorus Dekker. A floating-point technique for extending the available precision, 1971. [Viewer]
- Tight and rigourous error bounds for basic building blocks of double-word arithmetic., 2017. [PDF]
- Yozo Hida, Xiaoye Li, David Bailey. Library for Double-Double and Quad-Double Arithmetic, 2000. [PDF]
- Christoph Lauter Basic building blocks for a triple-double intermediate format, 2006. [PDF]
- Arithmetic Algorithms for Extended Precision Using Floating-Point Expansions, 2016. [PDF]
- Muller, J.-M. Brisebarre, N. de Dinechin, etc. Handbook of Floating-Point Arithmetic, Chapter 14, 2010.