bug-gmp
[Top][All Lists]
Advanced

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

Re: seg fault in mpz_root


From: Jason Moxham
Subject: Re: seg fault in mpz_root
Date: Wed, 11 Dec 2002 01:51:27 +0000
User-agent: KMail/1.4.1

On Tuesday 10 Dec 2002 11:36 pm, Kevin Ryde wrote:
> Jason Moxham <address@hidden> writes:
> > Can someone else confirm this ?
>
> It triggers an assertion failure under --enable-assert for me in the
> development sources.  Might be a buffer size or something.  Is this
> the same as you reported before?
>
> If you want to investigate, --enable-assert --enable-alloca=debug
> --host=none is a good config.

the fn mpn_rootrem , calculates an approx root which can be one unit too large 
, and then it powers it to see if it is too large , if the approx root is 3 , 
whereas the real root is 2 then after powering a lot more space is required

eg for our segging example

real root is 2
after the newton part the approx root is 3
we have allocated enough space for 2^800 , but we need to calculate 3^800

solutions :

1) would to be allocate enough space for the worst case  eg (3/2)^k more limbs 
,assuming mpn_rootrem is only called when root>=2

2) identified these worst cases (these cases can be identified fairly 
quickly(see my code for example)) and call a mpn_pow_1 which checks for 
overflow

3) do another(normal? termination is when next trial root is >= previous root) 
newton iteration step to get the exact root . The standard newton iteration 
is guarrenteed to get the correct root (see dumbmp.c ) .
I assume you did this for speed reasons

jason




reply via email to

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