public float testIndexPrecision(IndexBase index, double[][] inputData,
			double[][] testData, int[][] matches, float precision,
			int[] checks, Metric metric, int nn, int skipMatches) {
		float SEARCH_EPS = 0.001f;

		int c2 = 1;
		float p2;
		int c1 = 1;
		float[] time = new float[1];
		double[] dist = new double[1];

		p2 = searchWithGroundTruth(index, inputData, testData, matches, nn, c2,
				time, dist, metric, skipMatches);

		if (p2 > precision) {
			checks[0] = c2;
			return time[0];
		}

		while (p2 < precision) {
			c1 = c2;
			c2 *= 2;
			p2 = searchWithGroundTruth(index, inputData, testData, matches, nn,
					c2, time, dist, metric, skipMatches);
		}

		int cx;
		float realPrecision;

		if (Math.abs(p2 - precision) > SEARCH_EPS) {
			cx = (c1 + c2) / 2;
			realPrecision = searchWithGroundTruth(index, inputData, testData,
					matches, nn, cx, time, dist, metric, skipMatches);
			while (Math.abs(realPrecision - precision) > SEARCH_EPS) {

				if (realPrecision < precision) {
					c1 = cx;
				} else {
					c2 = cx;
				}
				cx = (c1 + c2) / 2;
				if (cx == c1) {
					break;
				}
				realPrecision = searchWithGroundTruth(index, inputData,
						testData, matches, nn, cx, time, dist, metric,
						skipMatches);
			}

			c2 = cx;
			p2 = realPrecision;

		} else {
			cx = c2;
			realPrecision = p2;
		}

		checks[0] = cx;
		return time[0];
	}