<div dir="ltr"><div><div><div>Thank you, Nelson!<br><br> It appears that, indeed, apart from theoretical research, there was not much actual work attempting to perfect the accuracy of the conversions until the 1990s. <br></div>Then I don't have to feel ashamed on behalf of the Soviet applied mathematicians that they didn't do a job good enough by today's standards in the mid-1970s.<br></div><div>That's a relief.<br><br></div>Regards,<br></div>Leo<br><br><div><div><div><div><div class="gmail_extra">On Mon, 17 Oct 2016 18:42:19 -0600, "Nelson H. F. Beebe" <<a href="mailto:beebe@math.utah.edu" target="_blank">beebe@math.utah.edu</a>> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
The discussions on this thread began with a question about the<br>
accuracy of binary->decimal->binary conversions.  The key original<br>
references are recorded in<br>
<br>
        <a href="http://www.math.utah.edu/pub/tex/bib/fparith.bib" rel="noreferrer" target="_blank">http://www.math.utah.edu/pub/t<wbr>ex/bib/fparith.bib</a><br>
        <a href="http://www.math.utah.edu/pub/tex/bib/fparith.html" rel="noreferrer" target="_blank">http://www.math.utah.edu/pub/t<wbr>ex/bib/fparith.html</a><br>
<br>
in entries Goldberg:1967:BED, Matula:1968:BCT, and Matula:1968:C.<br>
Those papers showed how many digits were needed for correct round-trip<br>
conversions, but did not exhibit code to do so.<br>
<br>
Some later papers had real source code, including Steele:1990:HPF,<br>
Clinger:1990:HRF, Clinger:2004:RHR, Burger:1996:PFP, Knuth:1990:SPW,<br>
and Abbott:1999:ASS.  The 20-year retrospectives in Clinger:2004:RHR<br>
and Steele:2004:RHP sum up that earlier work, and may be the best<br>
starting point to understand the problem.<br>
<br>
It is decidedly nontrivial: the Abbott paper in the section<br>
``Difficult numbers'' starting on page 739 discusses hard cases [where<br>
the exact result in the output base is almost exactly halfway between<br>
two machine numbers], and on page 740, they write ``The decimal size<br>
may be unbounded, because there is a natural bound derived from the<br>
exponent range, as was mentioned earlier. This bound is 126 digits for<br>
single, 752 for double, and 11503 for extended precision.''<br>
<br>
Entry Knuth:1990:SPW has the provocative title ``A Simple Program<br>
Whose Proof Isn't'': it examines the conversions between fixed-binary<br>
and decimal needed in the TeX typesetting system, a much simpler<br>
problem whose proof eluded Knuth for several years until this paper.<br>
A companion paper Gries:1990:BDO supplies an alternative proof of<br>
Knuth's algorithm.<br>
<br>
As to the first actual system to provide correct round-trip<br>
conversions, the Abbott paper on the IBM mainframe (S/360 to zSeries<br>
machines) describes the pressure to get it right the first time,<br>
because of the longevity of that architecture, and the high cost of<br>
repairing hardware implementations.<br>
<br>
The 1990 Steele and Clinger references above supply software<br>
implementations in Common Lisp exploiting the multiple-precision<br>
arithmetic supported in that language.<br>
<br>
Some current compilers, such as releases of gcc for the last several<br>
years, use the GMP and MPFR multiple-precision arithmetic packages to<br>
supply correct compile-time conversions.  Presumably, the revision<br>
history of GNU glibc would reveal when similar actions were taken for<br>
the strtod(), printf(), and scanf() families of the C and C++<br>
programming languages. I have not personally investigated that point,<br>
but perhaps other list members have, and can report their findings.<br>
<br>
>From scans of executables of assorted gcc versions, it appears that<br>
GMP and MPFR came into use in gcc-family compilers about mid-2007.<br>
The oldest gcc snapshot (of hundreds that I have installed) that<br>
references both those libraries is gcc-4.3-20070720.  However, the<br>
ChangeLog file in that release has mention on MPFR from 18-Nov-2006,<br>
and an entry of 11-Jan-2007 that says "Add gmp and mpfr".<br>
<br>
David M. Gay (then at AT&T Bell Labs renamed as Lucent Technologies)<br>
released an accurate implementation of strtod() marked "Copyright (C)<br>
1998-2001 by Lucent Technologies".  The oldest filedate in my personal<br>
archives of versions of that software is 22-Jun-1998, with changes up<br>
to 29-Nov-2007.<br>
<br></blockquote></div></div></div></div></div></div></div>