%mathpiper,def="IsEven"

IsEven(n) := IsInteger(n) And ( BitAnd(n,1)  = 0 );

%/mathpiper



%mathpiper_docs,name="IsEven",categories="User Functions;Predicates"
*CMD IsEven --- test for an even integer
*STD
*CALL
	IsEven(n)

*PARMS

{n} -- integer to test

*DESC

This function tests whether the integer "n" is even. An integer is
even if it is divisible by two. Hence the even numbers are 0, 2, 4, 6,
8, 10, etc., and -2, -4, -6, -8, -10, etc.

*E.G.

In> IsEven(4);
Result: True;
In> IsEven(-1);
Result: False;

*SEE IsOdd, IsInteger
%/mathpiper_docs