Bug affecting mpq_class::get_num() and mpq_class::get_den()?

8 Jun
2002
8 Jun
'02
11:43 a.m.
Hi there,
I believe the snippet following the signature shows a bug that is present in both GMP 4.0.1 and GMP 4.1. Please let me know if any workaround is possible. All the best
Roberto
--
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara@cs.unipr.it
/*
The GMP 4.x documentation says:
mpz_class& mpq_class::get_num ()
mpz_class& mpq_class::get_den ()
Get a reference to an `mpz_class' which is the numerator or
denominator of an `mpq_class'. This can be used both for read and
write access. If the object returned is modified, it modifies the
original `mpq_class'.
However, the following simple wrapper, gives, with GCC 3.0.4
$ g++ -W -Wall -c gmpbug.cc
gmpbug.cc: In function `mpz_class& numerator(mpq_class&)':
gmpbug.cc:24: could not convert `__gmp_expr<__gmpq_value,
__gmpq_value>::get_num()' to `mpz_class&'
*/
#include <gmpxx.h>
mpz_class&
numerator(mpq_class& r) {
return r.get_num();
}
8534
Age (days ago)
8534
Last active (days ago)
0 comments
1 participants
participants (1)
-
Roberto Bagnara