bug-gmp
[Top][All Lists]
Advanced

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

Re: seg fault in mpz_root patch


From: Jason Moxham
Subject: Re: seg fault in mpz_root patch
Date: Tue, 17 Dec 2002 02:47:44 +0000
User-agent: KMail/1.4.1

On Tuesday 17 Dec 2002 12:15 am, Kevin Ryde wrote:
> Jason Moxham <address@hidden> writes:
> > +     As the approximate root can be larger than the actual root by at
> > most +     a factor of 2 , we need to allow space for another "nth" bits
> > when +     powering it using mpn_pow_1 , this is a large overestimate
> > that only +     applies in rare cases i.e. when k is large and the root
> > is small +     FIXME : change this awful allocation before gmp 4.2
>
> Actually, we ought to try to do better now.  Basing an allocation on
> nth will prevent large roots being taken.  Not that very large nth is
> sensible, but it should work.
>

It is sensible , just not common :)

> Perhaps the number of bits in {up,usize} can be worked into the

Assuming TMP_ALLOC_LIMBS can be put in an if statement , like
if ( weird_condition ) pp=TMP_ALLOC_LIMBS(something);
else pp=TMP_ALLOC_LIMBS(somethingelse);

then OK

> calculation.  The intermediate power would be no more than twice that
> amount would it?  Or twice plus a few bits, or something.

The initial approximation is more trouble , unless you know of a reason why it 
can not overflow as well ? , mpn_pow_1 does nothing? , although a few tests 
with roots close to a power of two should tell me





reply via email to

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