Bug in C++ interface (comparison between rational and double)

Abramo Bagnara abramo.bagnara at gmail.com
Tue Jan 27 17:15:21 CET 2009

The comparison between mpz_class and double works fine with +inf and
-inf, while the comparison between mpq_class and double gives a floating
point exception, due to inappropriate mpq_set_d call in eval specialization.

I see two way to fix this:

1) add support for comparison between mpq and double in C interface and
use that in gmpxx.h

2) add infinity (and nan) check in comparison eval specializations in

IMHO 1) gives a more complete solution. If you want we're willing to
write the (trivial) patch.

Abramo Bagnara

Opera Unica                          Phone: +39.0546.656023
Via Borghesi, 16
48014 Castel Bolognese (RA) - Italy

More information about the gmp-bugs mailing list