%mathpiper,def="IsGaussianInteger"

5  # IsGaussianInteger(x_IsList)	<-- False;

// ?????? why is the following rule needed?
// 5  # IsGaussianInteger(ProductPrimesTo257)	<-- False;

10 # IsGaussianInteger(x_IsComplex)  	<-- (IsInteger(Re(x)) And IsInteger(Im(x)));
// to catch IsGaussianInteger(x+2) from Apart
15 # IsGaussianInteger(_x)	<-- False;

%/mathpiper



%mathpiper_docs,name="IsGaussianInteger",categories="User Functions;Predicates"
*CMD IsGaussianInteger ---  test for a Gaussian integer
*STD
*CALL
	IsGaussianInteger(z)
*PARMS

{z} -- a complex or real number	

*DESC

This function returns {True} if the argument is a Gaussian integer and {False} otherwise.
A Gaussian integer is a generalization
of integers into the complex plane. A complex number $a+b*I$ is a Gaussian
integer if and only if $a$ and $b$ are integers.

*E.G.
In> IsGaussianInteger(5)
Result: True;
In> IsGaussianInteger(5+6*I)
Result: True;
In> IsGaussianInteger(1+2.5*I)
Result: False;

*SEE  IsGaussianUnit, IsGaussianPrime
%/mathpiper_docs