[clean-list] Re: Re: 1.Floating Point Support (clean-list digest)
Richard A. O'Keefe
ok@atlas.otago.ac.nz
Tue, 21 Nov 2000 11:39:18 +1300 (NZDT)
On Mon, 20 Nov 2000, Siegfried Gonzi wrote:
> per def.: lim(n->infinity) (1 + 1/n)^n == e
>
> with the old 68040 Motorola they were able to use n>1.0e15, but with the 64bit and
> n>1.0e15 the above formula delivers 1.
RT Happe wrote:
In fact, the (...)^n converge to e but slowly.
Taking that limit doesn't make for an effective algorithm.
Think outside the box. It is clear that
lim(n->infinity) (1+1/n)**n
==
lim(k->infinity) (1+2**(-k))**(2**k)
and that *does* converge quickly enough to be useful.
Using 64-bit IEEE arithmetic, Sun pow() function, it only takes
53 iterates to get relative error better than 2E-16.
Simply plugging in the largest value of k you can gets you quite
a good answer.