Minor bug in dlnorm (PR#1781)

Thomas Lumley tlumley@u.washington.edu
Fri, 12 Jul 2002 13:19:53 -0700 (PDT)


On Fri, 12 Jul 2002 murdoch@stats.uwo.ca wrote:

> The density of a lognormal should be 0 for negative arguments, but
>
> > dlnorm(-1)
> [1] NaN
> Warning message:
> NaNs produced in: dlnorm(x, meanlog, sdlog, log)
>
> A simple fix is to change dlnorm's definition to:
>
> function (x, meanlog = 0, sdlog = 1, log = FALSE)
> .Internal(dlnorm(x*(x>0), meanlog, sdlog, log))
>
> It might be faster to put the same sort of adjustment into the
> internal code, but I couldn't spot where that lives.
>

In src/nmath/dlnorm.c.  I fixed it there.

	-thomas


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._