bug-gmp
[Top][All Lists]
Advanced

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

Re: Problem with assignment operator


From: Alex Stewart
Subject: Re: Problem with assignment operator
Date: Wed, 12 Jan 2005 09:46:30 -0500
User-agent: Mutt/1.5.6i

On Tue, Jan 11, 2005 at 09:27:25PM +0100, Emmanuel Thomé wrote:
> On Tue, Jan 11, 2005 at 08:40:21PM +0100, Linus Nordberg wrote:
> > The denominator mustn't be negative.  From the fine manual, section
> > Rational Number Functions:
> > 
> > Wether a segfault is a reasonable punishment for not obeying this
> > rule or not, I couldn't tell.  Cc to the GMP discussion list.
> 
> You're killed by the copy in mpq_set. Not surprising, as input
> requirements are not met. period.
> 
> The c++ ctor should perhaps call mpq_canonicalize ; sounds reasonable
> to me at least.

No, since mpq_canonicalize removes GCDs and is currently quadratic.

Perhaps something less drastic, like moving a negative sign to the
numerator, would be a better choice.

Alex




reply via email to

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