Boost logo

Boost :

Subject: Re: [boost] [xint] Boost.XInt formal review
From: Kim Barrett (kab.conundrums_at_[hidden])
Date: 2011-03-11 12:55:50


Not really about XInt, but responding to a side comment in Paul Bristow's review.

On Mar 11, 2011, at 5:12 AM, Paul A. Bristow wrote:
> A possible using-xint project (GSoC?) might be implementation of reading
> floating point (which require big (-ish) integers) of William D. Clinger
>
> http://www.cesura17.net/~will/Professional/Research/Papers/howtoread.pdf
>
> http://portal.acm.org/citation.cfm?id=93557
>
> and writing FP by Steele and White
>
> http://grouper.ieee.org/groups/754/email/pdfq3pavhBfih.pdf
>
> I am sure that there are many others.

The Grisu algorithm family doesn't require bignums. The results are better (as in "shorter") if there are more bits in the (fixed) integer representation than in the floating point significand. The paper focuses on printing IEEE doubles using 64 bit integers. According to the paper, Grisu2 produces the shortest output for approximately 99.9% of the inputs, and a longer but still correct output otherwise. Grisu3 (intended for use when shortest output is a requirement) produces the shortest result for 99.5% of IEEE doubles, providing a failure indication on the remainder so that one can fall back to some other algorithm (such as Steele & White's Dragon4, which does require bignums).

Printing Floating-Point Numbers Quickly and Accurately with Integers
Florian Loitsch
PLDI'10


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk