R Under development (unstable) (2023-11-19 r85561 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## Regression test for bug reported by John Nolan: > ## > ## Whenever the pair (x[i], a[i]) == (0,1), NA would be returned, due > ## to an internal computation of ( 0 * -Inf ) => NaN > ## > ## The code now checks for this particular issue and sets the value of > ## ( 0 * -Inf ) to 0, which is correct for this calculation. > ## > library(gtools) > > x <- c(0, 0, 1) > alpha <- c(1, 2, 3) > > stopifnot(ddirichlet(x = x, alpha = alpha) == 0) > > proc.time() user system elapsed 0.18 0.09 0.26