I found an email chain from December 2007. The work was done a few months before that, but 14 December was the Victoria University of Wellington Christmas BBQ. James Noble is the professor there (means head of department), Lindsay Groves another very senior guy. I see now that I got responses from both Guy Steele and Will Clinger:
From:
br...@hoult.org
Subject: reading floats
Date: 14 December 2007 12:34:34 AM
To:
k...@mcs.vuw.ac.nz
Hi James,
It was good to talk to you at the BBQ today.
I just did a quick check on the Java source. Double.valueOf(String)
and Double.parseDouble(String) call through to
sun.misc.FloatingDecimal.readJavaFormatString(String) to do the
parsing, and sun.misc.FloatingDecimal.doubleValue() to convert the
digits to a double.
https://openjdk.dev.java.net/source/browse/openjdk/jdk/trunk/jdk/src/
share/classes/sun/misc/FloatingDecimal.java?rev=257&view=markup
The guts of it is that the parsing allocates a char[] for the mantissa
digits that is large enough to hold the entire input string, after
trimming whitespace but still including sign and exponent. Except for
the easy special cases pointed out by Clinger (and Gay), doubleValue()
then does in fact use a bignum (FDBigInt) of the entire input mantissa
string, and another the same size calculated from the fp double
estimate value in order to come up with an adjustment to the estimated
double value.
That is, the bignums used are in fact of unbounded size, depending on
the length of the mantissa in the input string (less any leading and
trailing zeroes). i.e. if you feed it a string consisting of a few
million digits of pi then it's going to use a few MB of additional
working space, quite needlessly.
Would you like me to give you anything before you contact Guy Steele?
It certainly wouldn't take long to whip up a page or so of the basic
motivations, idea, and advantages.
I think it is very interesting from a theoretical perspective that I'm
effectively showing that a Finite State Machine is adequate to produce
correctly rounded floats from an input stream, contrary to the claims
in the literature. For example, the first paragraph of Clinger's
paper:
"Consider the problem of converting decimal scientific no-
tation for a number into the best binary floating point ap-
proximation to that number, for some fixed precision. This
problem cannot be solved using arithmetic of any fixed pre-
cision. Hence the IEEE Standard for Binary Floating-Point
Arithmetic does not require the result of such a conversion
to be the best approximation."
What I am claiming to show is that this is false, and that in fact a
fixed precision of only a few bits more than required for correctly
rounded printing (as laid out in the Steele and White paper) is
necessary. In fact for double precision IEEE floating point numbers a
handful of multiple precision integers of 36 words each (144 bytes,
1152 bits, total size of less than 1 KB) is always sufficient, even if
presented with extremely long input strings megabytes in size.
How to Read Floating Point Numbers Accurately
William D Clinger
http://portal.acm.org/citation.cfm?id=93557
How to Print Floating-Point Numbers Accurately
Guy L. Steele Jr. & Jon L White
http://portal.acm.org/citation.cfm?id=93559
Both in:
Proceedings of the ACM SIGPLAN'S Conference on
Programming Language Design and Implementation.
White Plains, New York, June 20-22, 1990.
Best regards,
Bruce
----
I didn't mention the actual idea in the previous email, so here it is,
as applied to double precision IEEE floats:
1) convert the input number with the mantissa truncated to the first
17 - 19 digits into the nearest double precision number using any
existing technique or library. 17 is the minimum necessary to
guarantee 0.5 ULP precision in selecting that double, but 19 fits into
a 64 bit integer which may be handy (especially if the entire mantissa
is only 18 or 19 digits anyway).
2) if you didn't truncate the mantissa then you're done.
3) the maximum error relative to the truncated mantissa is 0.5 ULP.
The error caused by truncating the mantissa is also strictly less than
0.5 ULP. The correct answer is either the double you already have or
else its successor.
4) start converting the midpoint of your double and it's successor to
decimal, using for example the Steele and White (FPP)^2 algorithm but
with the terminating condition being R becoming equal to zero
(implying an infinite number of trailing zeroes) rather than all that
mucking about being clever with low and high.
5) compare the generated digits to the digits in the original input
string. If you know that the string already passed fp parsing then
it's very simple. Just skip over any mixture of whitespace, signs,
zeroes, and decimal points to find the first non-zero digit. (special
case: input equal to zero). Then start scanning digits (ignoring
decimal points) and compare with the digits being generated in 4). Or
you can use information saved in the parsing stage. It depends on
whether you're using an existing library as a pure black box in step
1) or are able to modify it (or implement from a clean sheet).
6) if a digit matches then keep going. If a digit does not match then
stop immediately and you know which way to round. If the input number
terminates first then round down. If R in the generator loop becomes
zero first then round up. If both terminate at the same time then
round to even.
Note that there is no need to store the generated digits. Compare
them and discard.
Long mantissas that are not close to halfway between two doubles will
be examined for only a very short distance.
Even in the worst case, the decimal representation of all doubles
terminates. The longest are the numbers midway between denorms, For
example the smallest number that rounds to non-zero, which is the
number halfway between zero and the smallest denorm:
[Note: I have since realized that in fact Java gets this one wrong.
Due to "round to even" this should read as 0.0, and you need to
increase the 5 to a 6, or add e.g. "000000000000001" on the end to
make it go to 5E-324. Both my implementation and David Gay's "dtoa.c"
agree on this.]
0.0000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000024703282292062327208828439643411068
618252990130716238221279284125033775363510437593264991818081
799618989828234772285886546332835517796989819938739800539093
906315035659515570226392290858392449105184435931802849936536
152500319370457678249219365623669863658480757001585769269903
706311928279558551332927834338409351978015531246597263579574
622766465272827220056374006485499977096599470454020828166226
237857393450736339007967761930577506740176324673600968951340
535537458516661134223766678604162159680461914467291840300530
057530849048765391711386591646239524912623653881879636239373
280423891018672348497668235089863388587925628302755995657524
455507255189313690836254779186948667994968324049705821028513
185451396213837722826145437693412532098591327667236328125
That's 323 zeroes followed by 751 decimal digits which are those of
5^1075.
python -c 'print "0."+"0"*323+str(5**1075)'
Inputting this to, for example, Double.parseDouble(String) correctly
produces the smallest denorm (5E-324, though Sun Java prints it with
spurious precision as 4.9E-324).
Changing the last digit from a 5 to a 4 correctly produces a result
of 0.
The midpoints between other denorms are odd multiples of this number.
They terminate at the same number of places after the decimal, but
have up to 53 bits worth of extra significant digits (fewer leading
zeroes)
Thus, even if presented with an input string consisting of millions of
mantissa digits, you can *always* stop comparing after generating and
examining no more than 770 digits.
I have implemented this technique in a upcoming release of our
"alcheMo" J2ME to BREW porting product. Both parsing and printing
floating point numbers are achieved not only with correct rounding,
but also with no consing (e.g. when appending or inserting to a
StringBuffer with sufficient free space).
I also intend to implement it in one or both of the Dylan compilers
maintained at
http://www.opendylan.org, a group I have been a member
of since 1998. (I have also been captain of a team using Dylan to
enter the ICFP programming contest on a regular basis, including
gaining 2nd place twice and the Judge's prize twice).
I also intend to implement it as a modification to David Gay's
"dtoa.c", which appears to be the current industry standard, appearing
in everything from the iPhone up to mainframes.
In addition to the obvious speed advantages and space advantages of
not using unbounded bignums in extreme cases, this technique also
allows the use of stack-allocated bignums instead of heap allocated
one, which may further increase the speed, or perhaps even allow a FSM
implementation in hardware.
So, yes, I would be grateful if you could bring this to Guy's
attention and see what he thinks about it.
Cheers,
Bruce
------------------------------------------------------------------------------
from James Noble <
k...@mcs.vuw.ac.nz>
to Guy Steele <
Guy.S...@sun.com>,
cc Bruce Hoult <
br...@hoult.org>,
Lindsay Groves <
lin...@mcs.vuw.ac.nz>,
date Dec 14, 2007 4:30 PM
subject reading fixed precision floating point numbers
Hi Guy
so I'm writing to ask some advice about an interesting conversation
I had yesterday at our research group's Christmas party.
Bruce Hoult, a Wellington programmer, was asking for
advice about an algorithm he has developed and implemented to read
floating point numbers that requires only constant space (a little more
than the precision to which the number will be stored) rather than
working via arbitrary precision bignums.
I suggested he email you about this, but he thought you'd be more
likely to read emails from someone whom you know.
So, Bruce (and I) would be very interested in your opinion
of this work - whether you're aware of anything similar,
and whether you think e.g somewhere like PLDI would
still be interested in work on this topic.
I've copied in Bruce's emails below, if you've any thoughts
about this, we'd love to know what they are.
cheers
James
------------------------------------------------------------------------------
from Guy Steele <
Guy.S...@sun.com>
to James Noble <
k...@mcs.vuw.ac.nz>,
cc Bruce Hoult <
br...@hoult.org>,
Lindsay Groves <
lin...@mcs.vuw.ac.nz>,
date Dec 15, 2007 7:15 AM
subject Re: reading fixed precision floating point numbers
Yes, this sounds VERY interesting.
High order bit: I would suggest getting Will Clinger to take
a look at this as well, because he has studied the "read" problem
more closely than I have (I focused on the "print" problem,
which is related but a little different). You can reach him at
wi...@ccs.neu.edu .
I have read through the notes below and I think I grasp most
of the idea: assuming you can solve the print problem with limited
memory, you do a read on a truncated version of the input
to produce a result x such that reading the entire input ought
to produce either x or nextafter(x); then you print the value
(x+nextafter(x))/2, presumably using one extra bit of precision
and compare the result to the entire original input digit string.
The two parts I am unsure of are:
(1) I don't quite see how you do the read on the truncated input
string using limited memory in the situation where the input
consists of a decimal point and many zeros before the first
nonzero digit. The description below says:
> 1) convert the input number with the mantissa truncated to the first
> 17 - 19 digits into the nearest double precision number using any
> existing technique or library. ...
It speaks of "mantissa" rather than "fraction", so I'm not sure
whether it means the first 17 - 19 digits of the input string
or the first 17 - 19 *significant* digits. If the former, then
the first 17 digits of 0.00000000000000000000123 are all
zero, so the trial input x is zero, and (x+nextafter(x))/2 is not
the correct value. If the latter, then scaling by a potentially
large factor of 10 is required.
(2) Similarly, I am not sure how the space required by the
printing part of the process can be limited in all cases.
But I am very eager to hear more details that would eliminate
my puzzlement or confusion. If this algorithm is indeed as claimed,
it would surely merit presentation at PLDI. And if he were to
provide a plug-compatible replacement for David Gay's work
with improved performance, that would be a *great* service to
the community.
--Guy
------------------------------------------------------------------------------
James Noble to Bruce, Lindsay
Hi Bruce
WOW!
so you should be pretty pleased with this..
I presume you'll email WIll Clinger yourself?
but let me know how you go,
and obviously I'm keep to help out as I can
(as, I'm sure is Lindsay)
James
--------------------------------------------------------------
Lindsay Groves to Bruce, James
Hi Bruce
James said:
>WOW!
>
>so you should be pretty pleased with this..
I agree. That's a very encouraging respnse.
>I presume you'll email WIll Clinger yourself?
>but let me know how you go,
>and obviously I'm keep to help out as I can
>(as, I'm sure is Lindsay)
Indeed I am.
I haven't read through your initial message, or the follow-up, in detail, but
will do over the next few days. Maybe we should get together soonish and alk
about where to go with this. It looks like the PLDI cycle is papers due in
November and conference in June, so we've missed 2008. We could aim to have
something really solid prepared for next November for PLDI 2009, or look for
something else earlier which is suitable.
Cheers
Lindsay
--------------------------------------------------------------
from Bruce Hoult <
br...@hoult.org>
to Guy Steele <
Guy.S...@sun.com>,
cc James Noble <
k...@mcs.vuw.ac.nz>,
Lindsay Groves <
lin...@mcs.vuw.ac.nz>,
date Dec 15, 2007 10:41 AM
subject Re: reading fixed precision floating point numbers
On Dec 15, 2007 7:15 AM, Guy Steele <
Guy.S...@sun.com> wrote:
> Yes, this sounds VERY interesting.
Thank you.
> I have read through the notes below and I think I grasp most
> of the idea: assuming you can solve the print problem with limited
> memory, you do a read on a truncated version of the input
> to produce a result x such that reading the entire input ought
> to produce either x or nextafter(x); then you print the value
> (x+nextafter(x))/2, presumably using one extra bit of precision
> and compare the result to the entire original input digit string.
Nice summary.
The extra bit and the averaging is easy to come by, since when you
unpack x's mantissa into an integer of the same size of x you have a
lot of extra bits available. Also, approaching nextafter(x) from
below, you don't have to cope with the varying density of values above
and below exact 2^N values. (x+nextafter(x))/2 requires only
"f=(f<<1)+1; --e" (assuming e is already set to the same value as for
denorms in the case that x is zero, which is automatically true for
IEEE formats)
> The two parts I am unsure of are:
>
> (1) I don't quite see how you do the read on the truncated input
> string using limited memory in the situation where the input
> consists of a decimal point and many zeros before the first
> nonzero digit. The description below says:
>
> > 1) convert the input number with the mantissa truncated to the first
> > 17 - 19 digits into the nearest double precision number using any
> > existing technique or library. ...
>
> It speaks of "mantissa" rather than "fraction", so I'm not sure
> whether it means the first 17 - 19 digits of the input string
> or the first 17 - 19 *significant* digits.
Sorry, I just typed up those notes very quickly after leaving the BBQ
with James, so as to have *something* to show you and the terminology
is a little sloppy.
I meant the first 17 significant digits.
> If the former, then
> the first 17 digits of 0.00000000000000000000123 are all
> zero, so the trial input x is zero, and (x+nextafter(x))/2 is not
> the correct value. If the latter, then scaling by a potentially
> large factor of 10 is required.
Right. In my current implementation I count the leading zeroes and
ignore them and later subtract the count from the exponent. In fact
you do that for anything you find after the decimal anyway e.g.
123.4567e10 is treated as 1234567e6.
Interestingly, the Clinger paper (and everything else I've seen in the
literature) assumes that you have *already* done the parsing -- and in
fact already converted the fraction into a binary integer and suitably
adjusted the exponent -- *before* you even get into the algorithm
being discussed.
I suspect this may be a reason that no one seems to have realized what
a valuable resource the original decimal string is for getting the
rounding right!
> (2) Similarly, I am not sure how the space required by the
> printing part of the process can be limited in all cases.
Simply because the machine floating point formats are of fixed
precision and so the bignums used by the algorithms published by
yourself and White naturally achieve only limited sizes. The largest
you have to cope with in printing is approximately the mantissa bits
shifted left by the exponent (i.e. 53 bits shifted left by 1023 places
for IEEE doubles), plus a little bit more.
These integers aren't small but they're not exactly large, at least
until someone invents a new FP format with a few more exponent bits
:-)
> But I am very eager to hear more details that would eliminate
> my puzzlement or confusion. If this algorithm is indeed as claimed,
> it would surely merit presentation at PLDI. And if he were to
> provide a plug-compatible replacement for David Gay's work
> with improved performance, that would be a *great* service to
> the community.
The time and space performance on "normal" inputs of the size produced
by printing floating point numbers would be essentially unchanged from
that of the existing implementation. The only gain would come from
being able to reimplement the bignum operations to avoid dynamic
allocation, as they now require only a fixed upper size. This is
likely to be fairly minor.
Time is expected to be quite significantly improved for the "stupidly
long" input corner cases, though I don't have numbers yet as I have so
far only implemented my algorithm on BREW mobile phones where I don't
have a conventional correctly rounded algorithm to compare against
(the one built into BREW itself is junk). I was more interested in
the space (including code space) aspects there so have made a number
of space vs speed tradeoffs such as calculating powers of ten from
scratch each time rather than using a large table, and strictly
limiting the number of operations available in my bignum library to
the bare minimum.
I expect to find that if I truncate at N digits then performance for,
say, N+1 and N+2 digits may be slightly slower than for the current
method, due to the generation of the first 17 digits in the printing
stage taking a finite amount of time while being essentially useless.
I see several possible responses to this:
a) it doesn't matter
b) if you truncate at a larger number of digits than strictly
necessary (e.g. 19) and pay careful attention to the error bounds then
in 99%+ of input cases it can be proved that the ignored digits can't
affect the result anyway, so you don't need to perform the "printing"
stage.
c) if the input fraction is less than or equal to N digits (19, say)
then don't truncate it, but if the fraction is more than N digits then
truncate it to 17. There will exist a value of N for which reading
the truncated number and then printing the first N digits takes less
time than reading the full number. In this case I expect my algorithm
to strictly dominate existing ones, due merely to avoiding dynamic
allocation for small inputs, but with big O improvements for large
inputs.
Just a word on big O: converting a long decimal number to a bignum
binary by the usual method of multiplying by 10 and adding the next
digit is O(N^2) in the number of input digits, so any conventional
algorithm is unavoidably no less than O(N^2).
If you don't have to worry about malformed input then my modification
is O(1), since even for an input with millions of digits you can pick
the first significant digits of the fraction off the start of the
string (modulo leading zeroes), and the exponent off the end, convert
to the estimate x, and then generate no more than about 770 digits to
compare against the input string.
If you do have to worry about malformed input (and of course you do)
then the parsing is unavoidably O(N), and therefore so is my overall
algorithm.
Guy, thank you very much for your response!
Although I already have one working implementation of this (which will
be shipping to customers by the end of 2007) I know that I have quite
a lot of work still to do to put together a publishable paper,
especially at the PLDI level. What I think you have done is confirm
that it is worth putting in that effort, and I will further check that
with Will Clinger.
Best regards,
Bruce
-------------------------------------------------
from Bruce Hoult <
br...@hoult.org>
to Will Clinger <
wi...@ccs.neu.edu>,
cc Guy Steele <
Guy.S...@sun.com>,
James Noble <
k...@mcs.vuw.ac.nz>,
Lindsay Groves <
lin...@mcs.vuw.ac.nz>,
date Dec 16, 2007 2:18 PM
subject new idea for reading floating point numbers
Hi Will,
I believe I've got a new wrinkle on reading correctly rounded floating
point numbers. It's been run past Guy Steele and he also thinks it's
new but that I should run it past you to make doubly sure.
The background is that I'm a programmer for a small company called
Innaworks in Wellington, NZ, where we are making development tools for
people creating programs for small mobile devices (read: games for
cellphones...). Our current product which has been publicly available
since June is marketed as a "porting tool" for making Java
MicroEdition programs run on non-Java phones such as BREW. Of course
what it really is is a Java-compatible compiler and runtime system.
I'm responsible for the garbage collector, exception handling system,
threading library and the lowest level Java libraries (Strings, arrays
and Vectors, hash tables) and their interactions and tuning with the
GC and threads etc.
Lately I've been implementing floating point support for an upcoming
release and found conversion to and from strings a slightly deeper
subject than I'd expected. I've been using the 1990 PLDI papers by
you and Steele&White as a base, but with a few modifications mostly
designed to decrease code size, but also runtime memory size.
At a BBQ on Thursday I happened to ask James Noble (Victoria
University of Wellington, NZ) whether he thought one of my ideas was
worth publishing, and if so, how and where. He was quite enthusiastic
about the idea but as it's not in his area asked me to jot down a few
notes for him to forward to Steele, who he knows. Although I've fully
implemented and tested the idea and it will be shipping to our
customers next month I hadn't yet written it up at all. So my notes
are a bit rough and stream-of-consciousness, unfortunately.
The aspect I'm attacking is the corner case when you are presented
with a string longer (perhaps vastly longer) than those needed to
guarantee that values are preserved on a round-trip from binary to
string and back to binary. As you know, digits hundreds of
significant digits into the string can sometimes still affect which
floating point number is the closest to the value represented by the
string, and so must be considered.
The best published technique I know of (yours, with small
modifications by David Gay) requires unbounded working storage,
dependent on the size of the input. As you say in the introductory
paragraph of your 1990 paper: "This problem cannot be solved using
arithmetic of any fixed precision."
My technique uses yours as a subroutine but enables me to determine
the closest floating point value using a bounded amount of working
storage, no matter how long the input string is. For IEEE doubles all
needed variables total to less than 1 KB.
The best short summary I have at the moment is due to Steele:
"Assuming you can solve the print problem with limited
memory, you do a read on a truncated version of the input
to produce a result x such that reading the entire input ought
to produce either x or nextafter(x); then you print the value
(x+nextafter(x))/2, presumably using one extra bit of precision
and compare the result to the entire original input digit string."
I would be very interested to hear what you think of this idea, and
whether it is in fact new. Certainly it is not present in Gay's
library, and is not in Sun's Java code either.
I have implemented it on BREW (e.g. Verizon) phones and it works well.
I'm intending to implement it in at least the Gwydion Dylan compiler
(probably the former Harlequin Dylan as well), and also as a
modification to Gay's widely used dtoa.c.
I've attached the correspondence of the last day or two between
myself, James Noble and Guy Steele below.
Sincerely,
Brune Hoult
----------------------------------------------------
from
Guy.S...@sun.com
to Will Clinger <
wi...@ccs.neu.edu>,
cc James Noble <
k...@mcs.vuw.ac.nz>,
Bruce Hoult <
br...@hoult.org>,
Lindsay Groves <
lin...@mcs.vuw.ac.nz>,
date Dec 16, 2007 3:49 PM
subject Re: new idea for reading floating point numbers
Will (and everyone),
Let me chime in here that my two uncertainties turned out to be
an uncertainty as to the meaning of "limited storage". First of all,
we can agree that, for the read problem, the length of the input
string is in principle truly unlimited. I think we can also agree
that the amount of internal storage required is in principle dependent
on the length of the significand of the internal (binary) representation.
The two open questions are then:
(a) For both the read and print problems, is the amount of internal storage
required dependent on the exponent range of the internal (binary)
representation?
(b) For the read problem, is the amount of internal storage required
dependent on the value of any (decimal) exponent (such as one
specified after the letter "E" in computerized scientific notation)?
I believe that Bruce has indicated that, for his algorithm, the answer
to (a) is "yes", and with that answer, my two uncertainties as stated
in my previous email (which Bruce forwarded in his last email) are
resolved. I am still unsure about (b); I think that Bruce intends that
the answer be "no"; it may well be true, but I am still a bit uncertain
about how that is achieved without inspecting the algorithm in detail.
--Guy
----------------------------------------------------
fromWilliam D Clinger <
wi...@ccs.neu.edu>
toGuy....@sun.com,
wi...@ccs.neu.edu,
cc
br...@hoult.org,
k...@mcs.vuw.ac.nz,
lin...@mcs.vuw.ac.nz,
date Dec 16, 2007 5:23 PM
subject Re: new idea for reading floating point numbers
I will respond later in more detail, but it may well be
a week before I will have time to address everything the
way I'd like to. So I'm giving you my quick reactions
tonight before I go to bed.
Guy wrote:
> The two open questions are then:
> (a) For both the read and print problems, is the amount of internal storage
> required dependent on the exponent range of the internal (binary)
> representation?
> (b) For the read problem, is the amount of internal storage required
> dependent on the value of any (decimal) exponent (such as one
> specified after the letter "E" in computerized scientific notation)?
The answer to (a) is yes, and I think the answer to (b)
is yes also. (See below.)
I think the key insight of Bruce's algorithm is that the
bounded dynamic range of real floating point representations,
together with realistic practical bounds that may reasonably
be imposed upon the exponent that follows the E, allow a
finite state solution. For example, it is reasonable for
practical implementations to restrict the exponent that
follows the E to 64 decimal places or fewer, which implies
some bound on the number of digits you have to pay attention
to before the E.
Getting back to (b): It seems to me that, without assuming
some bound on the exponent, you'd need an unbounded amount
of storage just to keep track of n for inputs of the form
1000...000e-1000...000
--------- ---------
n zeroes m zeroes
It also seems to me that you *have* to keep track of n for
such inputs, just so you can figure out whether the negative
exponent cranks the value back into the dynamic range of your
floating point representation.
Bruce, can you confirm that you are assuming some bound on
the number of digits in the decimal notation's exponent?
Bruce wrote:
> "Consider the problem of converting decimal scientific no-
> tation for a number into the best binary floating point ap-
> proximation to that number, for some fixed precision. This
> problem cannot be solved using arithmetic of any fixed pre-
> cision. Hence the IEEE Standard for Binary Floating-Point
> Arithmetic does not require the result of such a conversion
> to be the best approximation."
>
> What I am claiming to show is that this is false...
What I believe you are claiming to show is that the problem
can be solved using fixed precision when both the precision
and the dynamic range of the binary floating point representation
are bounded.
I really did prove the theorem, but both the statement of the
theorem and its proof point toward the only possible ways to
escape from the theorem. The critical weakness of the theorem
is that it assumes a definition of binary floating point with
unlimited dynamic range. As I explained in my paper (and gave
a completely impractical algorithm besides!), a finite state
machine suffices when the dynamic range of binary floating
point numbers is bounded, and that is of course true for all
practical floating point formats.
What is surprising about your algorithm is that it bears so
much resemblance to the impractical algorithm I described
only to dismiss out of hand.
Your algorithm definitely works (although I think there may
be a couple of minor bugs in your description of it), and I
agree that it should be possible to implement it using only
bounded storage. At the moment, I don't see any contradiction
between that conclusion and the results of my paper.
> Just a word on big O: converting a long decimal number to a bignum
> binary by the usual method of multiplying by 10 and adding the next
> digit is O(N^2) in the number of input digits, so any conventional
> algorithm is unavoidably no less than O(N^2).
It seems, however, that regarding the bignums as polynomials
and multiplying them by methods described in Knuth 4.3.3 or
4.6.4 would be O(N lg N lg lg N), so I don't think this is
a promising line of argument.
Congratulations on your discovery of an interesting and
important new algorithm!
Will
-------------------------------------------
James Noble to Bruce, Lindsay
> Congratulations on your discovery of an interesting and
> important new algorithm!
what he said!
James
---------------------------------------------
Lindsay Groves to Bruce, James
>> Congratulations on your discovery of an interesting and
>> important new algorithm!
>
>what he said!
Ditto!
That's an amazingly positive response.
Cheers
Lindsay