[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: ratio implementation

**From**: |
Marius Vollmer |

**Subject**: |
Re: ratio implementation |

**Date**: |
Tue, 14 Oct 2003 15:03:41 +0200 |

**User-agent**: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) |

Bill Schottstaedt <address@hidden> writes:
>* I made the requested changes (using the Oct-9 CVS Guile):*
>
>* ftp://ccrma-ftp.stanford.edu/pub/Lisp/gratio-1.tar.gz*
With your new files, I now get
guile> (inexact->exact 123456789123456789.0)
0
This might have to do with your clever continued fraction
approximation procedure.
Also:
guile> (define pi (* 2 (acos 0)))
guile> (- (inexact->exact pi) pi)
3.31628058347633e-10
Shouldn't we be able to do better than this? Double precision is good
to about 2e-16 and I would expect the fraction returned from
inexact->exact to be accurate within that margin. (I don't know
inexact->really why I expect this, it just seems to make sense.)
What about this approach: find the integer correspondig to the bits of
the mantissa of the double number (a bignum) and then correct for the
scaling and the exponent either by multiplying with a power of two, or
building a fraction with that power of two.
I don't have the details ready yet, but I think I'll try to come up
with code for this... (when it isn't already in GMP).

**Re: ratio implementation**, *Marius Vollmer*, `2003/10/07`
**Re: ratio implementation**, *Marius Vollmer*, `2003/10/07`
**Re: ratio implementation**, *Bill Schottstaedt*, `2003/10/13`
**Re: ratio implementation**, *Marius Vollmer*, `2003/10/14`
**Re: ratio implementation**, *Marius Vollmer*, `2003/10/14`
**Re: ratio implementation**, *Kevin Ryde*, `2003/10/14`
**Re: ratio implementation**,
*Marius Vollmer* **<=**
**Re: ratio implementation**, *Kevin Ryde*, `2003/10/14`
**Re: ratio implementation**, *Bill Schottstaedt*, `2003/10/16`
**Re: ratio implementation**, *Marius Vollmer*, `2003/10/17`
**Re: ratio implementation**, *Bill Schottstaedt*, `2003/10/17`
**Re: ratio implementation**, *Rob Browning*, `2003/10/17`
**Re: ratio implementation**, *Kevin Ryde*, `2003/10/17`
**Re: ratio implementation**, *Bill Schottstaedt*, `2003/10/15`
**Re: ratio implementation**, *Marius Vollmer*, `2003/10/17`
**Re: ratio implementation**, *Rob Browning*, `2003/10/17`
**Re: ratio implementation**, *Marius Vollmer*, `2003/10/17`