[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Roberto Bagnara
Subject: Bug affecting mpq_class::get_num() and mpq_class::get_den()?
Date: Sat, 08 Jun 2002 11:43:57 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020516

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


Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy

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>

numerator(mpq_class& r) {
  return r.get_num();

reply via email to

[Prev in Thread] Current Thread [Next in Thread]