problem when converting from double

Décio Luiz Gazzoni Filho decio at
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 ( and play with the 
bestappr function.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: not available
Url :

More information about the gmp-discuss mailing list