Computes the average of two numbers.
@param x1 a number @param x2 a number @return the average of the inputs
static double average(double x1, double x2) { return (x1 + x2) / 2.0; }