From tlumley@u.washington.edu  Fri Jul 12 21:19:53 2002
From: tlumley@u.washington.edu (Thomas Lumley)
Date: Fri, 12 Jul 2002 13:19:53 -0700 (PDT)
Subject: Minor bug in dlnorm (PR#1781)
In-Reply-To: <200207121943.VAA26420@pubhealth.ku.dk>
Message-ID: <Pine.A41.4.44.0207121319300.194118-100000@homer06.u.washington.edu>

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


Minor bug in dlnorm (PR#1781)
Thomas Lumley