static int relativeSign(double x0, double x1) { if (x0 < x1) return -1; if (x0 > x1) return 1; return 0; }