converting a mpq to a double

Torbjorn Granlund tege at
Fri Jun 10 14:39:04 CEST 2005

Andreas Fabri <Andreas.Fabri at> writes:

  is there any kind of guarantee that the generated double is close
  to the rational number op.
I am afraid I don't understand.

The returned `double' is supposed to be a good approximation,
presumably within one ULP.  Whether that is "close" by your
definition, I don't know.  There are also degenerate cases where
the number is too large or too tiny for a `double'.

And I wouldn't dare to "guarantee" anything about the correctness
of GMP (see also COPYING.LIB).


More information about the gmp-discuss mailing list