[PURRS-devel] Re: Behavior of numeric::is_prime()

Richard B. Kreckel kreckel at ginac.de
Tue Oct 1 16:05:36 CEST 2002


On Tue, 1 Oct 2002, Roberto Bagnara wrote:
> In an attempt to invent documentation for the GiNaC
> facilities we use, we came across the following
> inconsistency in the behavior of the method
>
>    bool numeric::is_prime(void) const
>
> and the function
>
>    bool is_prime(const numeric &x),
>
> whereby exit(1) is called (via cl_abort()) if the number
> to be tested is a non-positive integer.
> I believe is_prime() should return false in this case,
> as it does for, e.g., -2/7, 2/7, 3*I, and 2.8943657489.
> All the best
>
>     Roberto
>
> P.S. I am not including a patch since this issues
>       may be dealt with either in CLN (which I believe
>       is the better option) or in GiNaC.

Thanks, I've fixed it.  It needs to be fixed in GiNaC, btw, since this is
where the cast to cln::cl_I occurs.

Regards
    -richy.
-- 
Richard B. Kreckel
<Richard.Kreckel at GiNaC.DE>
<http://www.ginac.de/~kreckel/>




More information about the PURRS-devel mailing list