[Rd] bug in pnorm (PR#699)

ratjamm@alum.mit.edu ratjamm@alum.mit.edu
Fri, 20 Oct 2000 21:46:19 +0200 (MET DST)

Full_Name: James Michael Rath
Version: all (I think)
OS: doesn't matter
Submission from: (NULL) (

The code for pnorm in R was adapted from a Fortran library published in the ACM
TOMS journal.  The published version had a typographical error, though, which
pointed out in a second article published three years after the original.

The error was that a macro/variable named SIXTEN had a value of 1.6e0 instead of
correct 1.6e1 (that is, 16 not 1.6).  The author of the code for R (Ross
must have worked from an outdated version of SPECFUN and not the corrected one
now appears in CALGO, STATLIB, et cetera.

There is a macro in pnorm.c (in the nmath directory) which looks like:
#define SIXTEN	1.6	/* Magic Cutoff */
It should be something like:
#define SIXTEN	16.0	/* Magic Cutoff */

I know this appears in R version 1.1.1.  I know it also appears in older
I do not know if it appears in newer ones.

The relevant references from ACM TOMS are:

Cody, W. D.  "Algorithm 715: SPECFUN - A portable FORTRAN package of special
  function routines and test drivers," in ACM TOMS 19, 22-32, 1993.

Price, David T.  "Remark on algorithm 715," in ACM TOMS 22(2), 258, 1996.


r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch