@Test public void lowerBound() throws Exception { assertEquals(0, WilsonScore.lowerBound(0, 0), precision); assertEquals(0.722, WilsonScore.lowerBound(10, 0), precision); assertEquals(0.963, WilsonScore.lowerBound(100, 0), precision); assertEquals(0.431, WilsonScore.lowerBound(100, 100), precision); assertEquals(0.000, WilsonScore.lowerBound(0, 100), precision); assertEquals(0.167, WilsonScore.lowerBound(30, 100), precision); assertEquals(1.000, WilsonScore.lowerBound(Integer.MAX_VALUE, 100), precision); }
public static double lowerBound(long upVoted, long downVoted) { if (upVoted == 0 && downVoted == 0) { return 0d; } long sum = upVoted + downVoted; if (sum >= Integer.MAX_VALUE) { return 1d; } return new WilsonScoreInterval().createInterval((int) sum, (int) upVoted, CONFIDENCE_LEVEL) .getLowerBound(); }
WilsonScore { public static double lowerBound(long upVoted, long downVoted) { if (upVoted == 0 && downVoted == 0) { return 0d; } long sum = upVoted + downVoted; if (sum >= Integer.MAX_VALUE) { return 1d; } return new WilsonScoreInterval().createInterval((int) sum, (int) upVoted, CONFIDENCE_LEVEL) .getLowerBound(); } }
WilsonScore { public static double lowerBound(long upVoted, long downVoted) { if (upVoted == 0 && downVoted == 0) { return 0d; } long sum = upVoted + downVoted; if (sum >= Integer.MAX_VALUE) { return 1d; } return new WilsonScoreInterval().createInterval((int) sum, (int) upVoted, CONFIDENCE_LEVEL) .getLowerBound(); } private  WilsonScore(); }
WilsonScore { public static double lowerBound(long upVoted, long downVoted) { if (upVoted == 0 && downVoted == 0) { return 0d; } long sum = upVoted + downVoted; if (sum >= Integer.MAX_VALUE) { return 1d; } return new WilsonScoreInterval().createInterval((int) sum, (int) upVoted, CONFIDENCE_LEVEL) .getLowerBound(); } private  WilsonScore(); static double lowerBound(long upVoted, long downVoted); }
WilsonScore { public static double lowerBound(long upVoted, long downVoted) { if (upVoted == 0 && downVoted == 0) { return 0d; } long sum = upVoted + downVoted; if (sum >= Integer.MAX_VALUE) { return 1d; } return new WilsonScoreInterval().createInterval((int) sum, (int) upVoted, CONFIDENCE_LEVEL) .getLowerBound(); } private  WilsonScore(); static double lowerBound(long upVoted, long downVoted); static final double CONFIDENCE_LEVEL; }