Robert G. Burger and R. Kent Dybvig, Printing floating point numbers quickly and accurately, ACM SIGPLAN 1996 Conference on Programming Language Design and Implementation, June 1996 (bibtex).

This paper presents a fast and accurate algorithm for printing floating-point numbers in both free- and fixed-format modes. In free-format mode, the algorithm generates the shortest, correctly rounded output string that converts to the same number when read back in, regardless of how the reader breaks ties when rounding. In fixed-format mode, the algorithm generates a correctly rounded output string using special # marks to denote insignificant trailing digits. For both modes, the algorithm employs a fast estimator to scale floating-point numbers efficiently.

KEYWORDS:
floating-point printing, run-time systems