Behavior of numeric::is_prime()

Roberto Bagnara bagnara at cs.unipr.it
Tue Oct 1 08:33:19 CEST 2002


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.

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it




More information about the GiNaC-list mailing list