12 unstable releases (5 breaking)

0.6.1 Nov 17, 2022
0.5.0 Apr 21, 2022
0.4.1 Nov 4, 2020
0.3.1 Jul 30, 2020
0.1.2 Mar 18, 2020

#170 in Algorithms

Download history 38/week @ 2022-08-14 41/week @ 2022-08-21 14/week @ 2022-08-28 31/week @ 2022-09-04 16/week @ 2022-09-11 9/week @ 2022-09-18 25/week @ 2022-09-25 31/week @ 2022-10-02 19/week @ 2022-10-09 6/week @ 2022-10-16 9/week @ 2022-10-23 124/week @ 2022-10-30 106/week @ 2022-11-06 61/week @ 2022-11-13 106/week @ 2022-11-20 205/week @ 2022-11-27

478 downloads per month
Used in ladata




Build Status Crate

A double-double arithmetic library for Rust.

This library provides an implementation of double-double arithmetic for the Rust language. Note that this is not the same as the IEEE quadruple-precision floating-point format. Instead, higher precision is obtained by representing the value as the sum of two non-overlapping f64 values.

Operator traits are implemented both for reference and value types where appropriate. The code indicates the source of the algorithms used.

Mathematical constants are available in the twofloat::consts module, which provides the same set of constants as std::f64::consts.

Please note that the implementation of the mathematical functions (exp, powf, etc.) is very preliminary. In particular, they are calculated using operations at the same precision as the result, so they will not return values which are correct to the full precision of the TwoFloat type. This may be addressed in future releases.

Optional features

  • math_funcs - include mathematical functions (enabled by default)
  • serde - enable serialization/deserialization with Serde.

Known issues

This library depends on the std implementations of the floating point mathematical functions, which in turn depend on the C standard library implementation, which may have variations between platforms.


  • Mioara Joldeș, Jean-Michel Muller, Valentina Popescu. Tight and rigourous error bounds for basic building blocks of double-word arithmetic. ACM Transactions on Mathematical Software, Association for Computing Machinery, 2017, 44 (2), pp. 1-27. 10.1145/3121432. hal-01351529v3

  • Alan H. Karp, Peter Markstein. High Precision Division and Square Root. ACM Transactions on Mathematical Software, Association for Computing Machinery, 1997, 23 (4), pp. 561-589. 10.1145/279232.279237.

  • S. Chevillard, M. Joldeș and C. Lauter. Sollya: an environment for the development of numerical codes. Mathematical Software - ICMS 2010, pp. 28–31.


~21K SLoC