[Rd] Re: 1/tan(-0) != 1/tan(0)
Morten Welinder
mwelinder at gmail.com
Wed Jun 1 16:16:17 CEST 2005
> For the real problem, the R source (in C), It's simple
> to work around the fact that
> qcauchy(0, log=TRUE)
> for Morten's code proposal gives -Inf instead of +Inf.
Ouch. Good catch.
Here is what happened: I reduced 1-exp(x) to -expm1(x) which is actual wrong for
x=0 because the results will be differently signed zeros.
I should have reduced 1-exp(x) to 0-expm1(x).
In light of this, any use of R_DT_qIv and R_DT_CIv might have the same problem.
(But, quite frankly, all uses of R_DT_qIv should be eliminated anyway.
Only qnorm
seems to be using it without killing the right-tail and the log cases.)
Morten
More information about the R-devel
mailing list