Ryū: fast float-to-string conversion

@article{Adams2018RyFF,
  title={Ryū: fast float-to-string conversion},
  author={Ulf Adams},
  journal={Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation},
  year={2018}
}
  • Ulf Adams
  • Published 11 June 2018
  • Computer Science
  • Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation
We present Ryū, a new routine to convert binary floating point numbers to their decimal representations using only fixed-size integer operations, and prove its correctness. Ryū is simpler and approximately three times faster than the previously fastest implementation. 

Figures from this paper

Ryū revisited: printf floating point conversion
  • Ulf Adams
  • Computer Science
    Proc. ACM Program. Lang.
  • 2019
TLDR
It is shown that both Ryū and Ryū Printf generalize to arbitrary number bases, which implies the existence of a fast algorithm to convert from base-10 to base-2, as long as the maximum precision of the input is known a priori.
Number parsing at a gigabyte per second
  • D. Lemire
  • Computer Science
    Softw. Pract. Exp.
  • 2021
TLDR
By combining the significand and precomputed tables, the solution to the problem of parsing decimal numbers to the nearest binary floating‐point value can be several times faster than conventional functions present in standard C libraries on modern 64‐bit systems.
Grassland: A Rapid Algebraic Modeling System for Million-variable Optimization
TLDR
Grassland is a rapid AMS that provides an end-to-end solution to tackle emerged new challenges, and integrates a parallelized instantiation scheme for large-scale linear constraints, and a sequential decomposition method that accelerates model solving exponentially with an acceptable loss of optimality.

References

SHOWING 1-10 OF 18 REFERENCES
Easy Accurate Reading and Writing of Floating-Point Numbers
TLDR
Presented here are algorithms for converting between (decimal) scientific-notation and (binary) IEEE-754 double-precision floating-point numbers by employing a rounding integer quotient operation, which execute as fast or faster than Java's native conversions over nearly all of the IEEE-753 double- Precision range.
Correctly Rounded Binary-Decimal and Decimal-Binary Conversions
TLDR
This note discusses the main issues in performing correctly rounded decimal-to-binary and binary- to-decimal conversions and describes some efficiency enhancements.
How to print floating-point numbers accurately
TLDR
Algorithms for accurately converting floating-point numbers to decimal representation and modification of the well-known algorithm for radix-conversion of fixed-point fractions by multiplication for use in fixed-format applications.
Binary conversion, with fixed decimal precision, of a decimal fraction
Problem Given a decimal fraction £ find a binary approximation fi, to f, with a given decimal precisioa h, 1. (liven0 N f < 1 andh > (k 2, Find j; such that If-,f~ i ~ h.
Special Feature an Implementation Guide to a Proposed Standard for Floating-Point Arithmetic
This guide to an IEEE draft standard provides practical algorithms for floating-point arithmetic operations and suggests the hardware/software mix for handling exceptions.
Printing floating-point numbers quickly and accurately with integers
We present algorithms for accurately converting floating-point numbers to decimal representation. They are fast (up to 4 times faster than commonly used algorithms that use high-precision integers)
Printing floating-point numbers: a faster, always correct method
TLDR
Errol is presented, a new complete algorithm that is guaranteed to produce correct and optimal results for all inputs while simultaneously being 2x faster than the incomplete Grisu3 and 4X faster than previous complete methods.
Printing floating-point numbers quickly and accurately
TLDR
This paper presents a fast and accurate algorithm for printing floating-point numbers in both free- and fixed-format modes, and employs a fast estimator to scale floating- point numbers efficiently.
Division by invariant integers using multiplication
TLDR
This paper presents code sequences for division by arbitrary nonzero integer constants and run-time invariants using integer multiplication using a two's complement architecture, and treats unsigned division, signed division, and division where the result is known a priori.
An implementation guide to a proposed standard for floating-point arithmetic
This standard is a product of the Floating-Point Working Group of the Microprocessor Standards Subcommittee of the Standards Committee of the IEEE Computer Society. This work was sponsored by the
...
...