public static double choose(int n, int k) {
        if (n < 0 || k < 0) {
            throw new IllegalArgumentException(String.format("Invalid n = %d, k = %d", n, k));
        }

        if (n < k) {
            return 0.0;
        }

        return floor(0.5 + exp(lchoose(n, k)));
    }
@Test
    public void testChoose() {
        System.out.println("choose");
        assertEquals(1.0, MathEx.choose(10, 0), 1E-7);
        assertEquals(10.0, MathEx.choose(10, 1), 1E-7);
        assertEquals(45.0, MathEx.choose(10, 2), 1E-7);
        assertEquals(120.0, MathEx.choose(10, 3), 1E-7);
        assertEquals(210.0, MathEx.choose(10, 4), 1E-7);
    }