1## Regression test for bug reported by John Nolan:
2##
3## Whenever the pair (x[i], a[i]) == (0,1), NA would be returned, due
4## to an internal computation of ( 0 * -Inf ) => NaN
5##
6## The code now checks for this particular issue and sets the value of
7## ( 0 * -Inf ) to 0, which is correct for this calculation.
8##
9library(gtools)
10
11x <- c(0, 0, 1)
12alpha <- c(1, 2, 3)
13
14stopifnot(ddirichlet(x = x, alpha = alpha) == 0)
15