
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.

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.
participants (2)
-
Richard B. Kreckel
-
Roberto Bagnara