[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: divisibility tests
From: |
Jason Moxham |
Subject: |
Re: divisibility tests |
Date: |
Fri, 22 Nov 2002 22:35:52 +0000 |
User-agent: |
KMail/1.4.1 |
On Wednesday 13 Nov 2002 8:06 pm, Kevin Ryde wrote:
> Jason Moxham <address@hidden> writes:
> > mpz_divisible is testing that one number is divisible by another , not
> > doing any division , so it should not have a DIVIDE_BY_ZERO error.
>
> I took the view that it corresponded to "mpz_fdiv_ui(a,d)==0" and
> therefore d==0 should be disallowed. It didn't seem like a
> particularly sensible input either.
mpz_perfect_square_p returns false on a negative input and not an exception ,
so the function is testing to see if a negative number is square , but not
actually trying to compute the square root. For consistency mpz_divisible_p
should do the same when testing for divisibility by zero.
I agree that these are not very important cases , but consistency is good.
A note in the docs should mention that that the divisibility tests can raise
an exception.