From maechler at stat.math.ethz.ch  Mon Jul 11 09:36:27 2005
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Mon, 11 Jul 2005 09:36:27 +0200
Subject: [Rd] qgamma with first argument 1
In-Reply-To: <dap8e5$7iu$1@sea.gmane.org>
References: <dap8e5$7iu$1@sea.gmane.org>
Message-ID: <17106.8571.506104.670879@stat.math.ethz.ch>

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.

Regards,
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



[Rd] qgamma with first argument 1
Martin Maechler