# NOT RUN {
curve(-log(x*gamma(x)), 1e-30, .8, log="xy", col="gray50", lwd = 3,
axes = FALSE, ylim = c(1e-30,1))
sfsmisc::eaxis(1); sfsmisc::eaxis(2)
at <- 10^(1-4*(0:8))
abline(h = at, v = at, col = "lightgray", lty = "dotted")
curve(-lgamma( 1+x), add=TRUE, col="red2", lwd=1/2)# underflows even earlier
curve(-lgamma1p (x), add=TRUE, col="blue") -> lgxy
curve(-lgamma1p.(x), add=TRUE, col=adjustcolor("forest green",1/4),
lwd = 5, lty = 2)
for(k in 1:7)
curve(-lgamma1p_series(x, k=k), add=TRUE, col=paste0("gray",30+k*8), lty = 3)
stopifnot(with(lgxy, all.equal(y, -lgamma1pC(x))))
# }
# NOT RUN {
<!-- %% FIXME: Have *relevant* mpfr-based relative error comparisons "hidden" in ../tests/qgamma-ex.R !! -->
# }
Run the code above in your browser using DataLab