bug-gmp
[Top][All Lists]
Advanced

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

Re: Bugs!!


From: Kevin Ryde
Subject: Re: Bugs!!
Date: 01 Dec 2000 10:06:18 +1000
User-agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.5

Kaushik Chakraborty <address@hidden> writes:
>
> ./test 0 1
> jacobi = 1
> legendre= 1         
> 
>  ./test 0 5
> jacobi = 0
> legendre= 0          
> 
> [HOW CAN BE THE ABOVE TWO DIFFERENT??]

I think it's correct.  I think it's from the rule that (a/b)=0 if and
only if gcd(a,b)!=1, so with gcd(0,1)=1 but gcd(0,5)=5 then (0/1) and
(0/5) will be different.


>  ./test 0 0
> Floating point exception (core dumped) [NO CHECK IS THERE FOR 0 CASE]
> 
> ./test 0 -5
> jacobi = 0
> legendre= 0          
> 
> BUT
> 
>  ./test 0 -3 
> 
> [HANGS!! CONTROL DOESNOT RETURN!!]

Alas, mpz_jacobi and mpz_legendre currently require b>0.  A note about
that was added to the manual in GMP version 3.1.


> Actually the domain of values for which legendre & jacobi are defined is
> not checked for correctness...
> so the user has to be careful...
> otherwise if he runs a long program
> where one step is..
> for primes in (0,1,2,.........)
> it is difficult for him to figure out that the legendre or jacobi call is
> making problem for 0,1, or say -ve values..
> 
> So, the legendre or jacobi source code may have some error checking code
> in the beginning to avoid above situations..

Or better, give the right answers!  :-)

The current GMP version 3.1.1 has mpz_kronecker_si and related
functions supporting negatives (and running much faster than
mpz_jacobi), if they meet your needs.

Improvements to mpz_jacobi, or a new mpz_kronecker, are planned but I
don't know when they'll get done.



reply via email to

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