/**
* Test for equality up to a given precision.
* <p>
* The precision argument sets how many digits of precision after the
* decimal to consider.
*
* @param c
* the Complex to compare for equality.
* @param precision
* the number of digits of precsion to use.
* @return true if this Complex is equal (within precision) to the argument,
* false otherwise.
*/
public boolean equals(Complex c, int precision) {
double mult = Math.pow(10, precision);
double precRe = ((int) (re * mult)) / mult;
double precIm = ((int) (im * mult)) / mult;
double parPrecRe = ((int) (c.getRe() * mult)) / mult;
double parPrecIm = ((int) (c.getIm() * mult)) / mult;
if (precRe != parPrecRe)
return false;
if (precIm != parPrecIm)
return false;
return true;
}