[Rd] qgamma with first argument 1

Martin Maechler maechler at stat.math.ethz.ch
Mon Jul 11 09:36:27 CEST 2005

Thank you, Mr Hosking,

yes, this is a buglet.

I had started to fix this (and similar cases) 
--  using a C Macro based approach in src/nmath/dpq.h  --

For this reason, the fix will probably only appear in R-devel
i.e., from R-2.2.0 on, and not yet in [R 2.1.1]-patched.

Martin Maechler, ETH Zurich

>>>>> "J" == J Hosking <jh910 at juno.com>
>>>>>     on Sat, 09 Jul 2005 15:27:00 -0400 writes:

    >> qgamma(1,1.1)
    J> [1] Inf

    J> as expected.  But for shape parameter between 0.16 and 1:

    >> qgamma(1,.5)
    J> [1] NaN
    J> Warning message:
    J> NaNs produced in: qgamma(p, shape, scale, lower.tail, log.p)

    J> and for shape parameter 0.16 or less:

    >> qgamma(1,.1)
    J> [1] 99.42507

    J> Arguments close to 1 give approximately correct results:

    >> qgamma(1-1e-15,.5)
    J> [1] 32.05055
    >> qgamma(1-1e-15,.1)
    J> [1] 28.8129

More information about the R-devel mailing list