From terra at gnome.org  Wed Mar 24 15:53:21 2004
From: terra at gnome.org (terra@gnome.org)
Date: Wed Mar 24 15:53:23 2004
Subject: [Rd] R_DT_val accuracy (PR#6692)
Message-ID: <20040324145321.816141043C@slim.kubism.ku.dk>

Full_Name: M. Welinder
Version: 1.8.1
OS: Solaris
Submission from: (NULL) (65.213.85.227)


Currently R has...

#define R_D_Lval(p)	(lower_tail ? (p) : (1 - (p)))	/*  p  */
#define R_D_val(x)	(log_p	? log(x) : (x))		/*  x  in pF(x,..) */
#define R_DT_val(x)	R_D_val(R_D_Lval(x))		/*  x  in pF */

...which is sub-optimal in the lower_tail==FALSE && log_p==TRUE case.
Something like this ought to work better.

#define R_DT_val(x)	(log_p	? (lower_tail ? log(x) : log1p (-(x))) :
(R_D_Lval(x)))

Similarly for R_DT_Cval.

This affects the accuracy of phyper, for example.


[Rd] R_DT_val accuracy (PR#6692)
terra@gnome.org