Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/2837614.2837654acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

Printing floating-point numbers: a faster, always correct method

Published: 11 January 2016 Publication History
  • Get Citation Alerts
  • Abstract

    Floating-point numbers are an essential part of modern software, recently gaining particular prominence on the web as the exclusive numeric format of Javascript. To use floating-point numbers, we require a way to convert binary machine representations into human readable decimal outputs. Existing conversion algorithms make trade-offs between completeness and performance. The classic Dragon4 algorithm by Steele and White and its later refinements achieve completeness --- i.e. produce correct and optimal outputs on all inputs --- by using arbitrary precision integer (bignum) arithmetic which leads to a high performance cost. On the other hand, the recent Grisu3 algorithm by Loitsch shows how to recover performance by using native integer arithmetic but sacrifices optimality for 0.5% of all inputs. We present Errol, 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.

    References

    [1]
    R. G. Burger and R. K. Dybvig. Printing floating-point numbers quickly and accurately. In PLDI, 1996.
    [2]
    J. T. Coonen. An implementation guide to a proposed standard for floating-point arithmetic. IEEE Computer, 13(1), 1980.
    [3]
    J. T. Coonen. Contributions to a Proposed Standard for Binary Floating-point Arithmetic (Computer Arithmetic). PhD thesis, 1984.
    [4]
    T. Dekker. A floating-point technique for extending the available precision. Numerische Mathematik, 18(3), 1971.
    [5]
    D. M. Gay. Correctly rounded binary-decimal and decimal-binary conversions. In Numerical Analysis Manuscript. 1990.
    [6]
    D. Goldberg. What every computer scientist should know about floating-point arithmetic. ACM Comput. Surv., 23(1), 1991.
    [7]
    Y. Hida, X. S. Li, and D. H. Bailey. Algorithms for quad-double precision floating point arithmetic. In Symp. on Computer Arithmetic, 2001.
    [8]
    W. Kahan. Pracniques: Further remarks on reducing truncation errors. Commun. ACM, 8(1), 1965.
    [9]
    D. E. Knuth. The Art of Computer Programming, Volume II: Seminumerical Algorithms, 2nd Edition.
    [10]
    F. Loitsch. Printing floating-point numbers quickly and accurately with integers. In PLDI, 2010.
    [11]
    D. W. Matula. In-and-out conversions. Commun. ACM, 11(1), 1968.
    [12]
    D. M. Priest. On Properties of Floating Point Arithmetics: Numerical Stability and the Cost of Accurate Computations. PhD thesis, 1992.
    [13]
    J. R. Shewchuk. Adaptive precision floating-point arithmetic and fast robust geometric predicates. Discrete & Computational Geometry, 18: 305––363, 1996.
    [14]
    G. L. Steele and J. L. White. How to print floating-point numbers accurately. In PLDI, 1991.

    Cited By

    View all

    Index Terms

    1. Printing floating-point numbers: a faster, always correct method

      Recommendations

      Comments

      Information & Contributors

      Information

      Published In

      cover image ACM Conferences
      POPL '16: Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages
      January 2016
      815 pages
      ISBN:9781450335492
      DOI:10.1145/2837614
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 51, Issue 1
        POPL '16
        January 2016
        815 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2914770
        • Editor:
        • Andy Gill
        Issue’s Table of Contents
      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

      Sponsors

      In-Cooperation

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      Published: 11 January 2016

      Permissions

      Request permissions for this article.

      Check for updates

      Author Tags

      1. double-double
      2. dtoa
      3. floating-point printing

      Qualifiers

      • Research-article

      Conference

      POPL '16
      Sponsor:

      Acceptance Rates

      Overall Acceptance Rate 824 of 4,130 submissions, 20%

      Upcoming Conference

      POPL '25

      Contributors

      Other Metrics

      Bibliometrics & Citations

      Bibliometrics

      Article Metrics

      • Downloads (Last 12 months)15
      • Downloads (Last 6 weeks)2
      Reflects downloads up to 10 Aug 2024

      Other Metrics

      Citations

      Cited By

      View all
      • (2022)EARSACM Transactions on Graphics10.1145/3528223.353016841:4(1-14)Online publication date: 22-Jul-2022
      • (2022)Efficiency-aware multiple importance sampling for bidirectional rendering algorithmsACM Transactions on Graphics10.1145/3528223.353012641:4(1-12)Online publication date: 22-Jul-2022
      • (2022)Regression-based Monte Carlo integrationACM Transactions on Graphics10.1145/3528223.353009541:4(1-14)Online publication date: 22-Jul-2022
      • (2021)Learning meaningful controls for fluidsACM Transactions on Graphics10.1145/3450626.345984540:4(1-13)Online publication date: 19-Jul-2021
      • (2021)Learning a family of motor skills from a single motion clipACM Transactions on Graphics10.1145/3450626.345977440:4(1-13)Online publication date: 19-Jul-2021
      • (2021)Number parsing at a gigabyte per secondSoftware: Practice and Experience10.1002/spe.298451:8(1700-1727)Online publication date: 11-May-2021
      • (2019)Certifying graph-manipulating C programs via localizations within data structuresProceedings of the ACM on Programming Languages10.1145/33605973:OOPSLA(1-30)Online publication date: 10-Oct-2019
      • (2019)IntelliMerge: a refactoring-aware software merging techniqueProceedings of the ACM on Programming Languages10.1145/33605963:OOPSLA(1-28)Online publication date: 10-Oct-2019
      • (2019)Ryū revisited: printf floating point conversionProceedings of the ACM on Programming Languages10.1145/33605953:OOPSLA(1-23)Online publication date: 10-Oct-2019
      • (2019)Staged abstract interpreters: fast and modular whole-program analysis via meta-programmingProceedings of the ACM on Programming Languages10.1145/33605523:OOPSLA(1-32)Online publication date: 10-Oct-2019
      • Show More Cited By

      View Options

      Get Access

      Login options

      View options

      PDF

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      Media

      Figures

      Other

      Tables

      Share

      Share

      Share this Publication link

      Share on social media