# Printing floating-point numbers quickly and accurately with integers

```@inproceedings{Loitsch2010PrintingFN,
title={Printing floating-point numbers quickly and accurately with integers},
author={Florian Loitsch},
booktitle={PLDI '10},
year={2010}
}```
We present algorithms for accurately converting floating-point numbers to decimal representation. [] Key Method Our second algorithm improves on the first one by using the additional bits to produce a shorter (often the shortest) result. Finally we propose a third version that can be used when the shortest output is a requirement. The last algorithm either produces optimal decimal representations (with respect to shortness and rounding) or rejects its input. For IEEE 754 double-precision numbers and 64-bit…

## Figures from this paper

Printing floating-point numbers: a faster, always correct method
• Computer Science
POPL
• 2016
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 An Always Correct Method
• Computer Science
• 2016
Errol is presented, a new complete algorithm that is guaranteed to produce correct and optimal results for all inputs by sacrificing a speed penalty to the incomplete Grisu3 but 5.2× faster than previous complete methods.
Ryū revisited: printf floating point conversion
• Computer Science
Proc. ACM Program. Lang.
• 2019
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
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.
Basic Properties and Algorithms
• Computer Science
• 2010
In this chapter, we present some short yet useful algorithms and some basic properties that can be derived from specifications of floating-point arithmetic systems, such as the ones given in the
Ryū: fast float-to-string conversion
Ryū, a new routine to convert binary floating point numbers to their decimal representations using only fixed-size integer operations, is presented and its correctness is proved.
Infra: structure all the way down: structured data as a visual programming language
• Computer Science
Onward!
• 2017
It is argued that Infra can be used to improve existing software projects and that bringing direct authoring and human readability to a binary data paradigm could have rippling ramifications on the computing landscape.
Abstraction in technical computing
Aion in Technical Computing by Jeffrey Werner Bezanson A.B., Harvard University (2004) S.M., Massachusetts Institute of Technology (2012) andsubmitted to the Department of Electrical Engineering and Computer Science in partial fulfillment of the requirements for the degree of Doctor of Philosophy.
The Mathematical-Function Computation Handbook
• N. H. Beebe
• Mathematics
Springer International Publishing
• 2017

## References

SHOWING 1-10 OF 11 REFERENCES
How to print floating-point numbers accurately
• Computer Science
PLDI '90
• 1990
Algorithm for accurately converting floating-point numbers to decimal representation to carry along with the computation an explicit representation of the required rounding accuracy and modify the free-format conversion algorithm for use in fixed-format applications.
How to print floating-point numbers accurately
• Computer Science
SIGP
• 2004
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.
Printing floating-point numbers quickly and accurately
• Computer Science
PLDI '96
• 1996
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.
Contributions to a proposed standard for binary floating-point arithmetic (computer arithmetic)
This thesis consists of a set of "footnotes" to the proposed standard for binary floating-point arithmetic, which include an analysis of gradual underflow, the most controversial feature of the standard.
Correctly Rounded Binary-Decimal and Decimal-Binary Conversions
This note discusses the main issues in performing correctly rounded decimal-to-binary and binary- to-decimal conversions and describes some efficiency enhancements.
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
What Every Computer Scientist Should Know About Floating-Point Arithmetic
The OPEN LOOKand Sun™ Graphical User Interfaces were developed by Sun Microsystems, Inc. for its users and licensees and Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry.
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.
Standard for Binary Floating-Point Arithmetic
• Standard for Binary Floating-Point Arithmetic
• 1985