[Rd] pgeom accuracy (PR#6687)

maechler at stat.math.ethz.ch maechler at stat.math.ethz.ch
Wed Mar 24 08:36:14 CET 2004

>>>>> "Morten" == Morten Welinder <terra at gnome.org>
>>>>>     on Tue, 23 Mar 2004 19:10:07 +0100 (CET) writes:

    Morten> Full_Name: M. Welinder Version: 1.6.2 and 1.8.1 OS:
    Morten> Solaris Submission from: (NULL) (

    Morten> The common lower_tail==TRUE && log_p==FALSE case can
    Morten> be improved as

    Morten>   if (lower_tail && !log_p) return -expm1 ((x + 1) *
    Morten> log1p (-p));

    Morten> This improves precision when p is very small and x
    Morten> not too big by avoiding two problematic "1-sth"
    Morten> calculations.

That's entirely correct,
Thank you, Morten!

Improvement committed for R 1.9.0 beta.

More information about the R-devel mailing list