These methods, and the corresponding functions taking
the argument as a const numeric& parameter, when something
goes wrong print a line of the form
Not a 32-bit integer: -9223372028264841216
on cerr and exit the program. Wouldn't throwing a
suitable standard exception (like std::domain_error)
be a better option?
All the best
Roberto
--
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara@cs.unipr.it
The function
numeric irem(const numeric &a, const numeric &b)
prints "Division by zero." and exits when b is zero.
As in all the other cases reported, this makes it
more difficult to write robust software. Of course,
we can check b before calling irem() (and we are doing it)
but this impedes performance for no reason, since the
test on b must be re-done anyway in order to decide whether
to print the error message and exit.
All the best
Roberto
--
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara@cs.unipr.it
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@cs.unipr.it