Hi All,
I was wondering if the following would be an improvement for testing if a
number is a square (from Integer.cpp). It is a quick and dirty test. I ask
because I want to perform a lot if tests using IsSquare() on quadrtic residues.
bool Integer::IsSquare() const
{
Integer r;
word digit = 0;
if( false == IsNegative( ) ) {
Integer::Divide(digit, r, *this, 10);
//\ Perfect squares end in the following
if( digit != 0 && digit != 1 && digit != 4 &&
digit != 5 && digit != 6 && digit != 9 ) { return false; }
}
r = SquareRoot();
return *this == r.Squared();
}