problem when converting from double

Décio Luiz Gazzoni Filho decio at decpp.net
Fri Jan 28 17:28:49 CET 2005


On Friday 28 January 2005 13:16, Thomas Abraham wrote:
> hi,
>
> I am a beginner with GMP so this may sound stupid :
>
> I am trying to convert a double type to rational and then find the
> numerator and denominator integers. so i do

You won't get meaningful approximations by using the built-in functions, in 
particular due to the quirks of representing numbers in a given base and 
converting numbers from one base to another, as noted by the sibling post. 
I'd suggest using continued fraction theory instead. For instance, download 
the PARI/GP package (http://pari.math.u-bordeaux.fr/) and play with the 
bestappr function.

Décio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: not available
Url : http://gmplib.org/list-archives/gmp-discuss/attachments/20050128/71b7b77b/attachment.bin


More information about the gmp-discuss mailing list