[R] 16 digits and beyond? R64-bit a solution?

Charles C. Berry cberry at tajo.ucsd.edu
Sat Feb 7 02:09:14 CET 2009

On Fri, 6 Feb 2009, Aldi Kraja wrote:

> Hi,
> I am working with some extremely small p-values and I want to capture the 
> corresponding quantiles.
> I see the help file it says:
>     'qnorm' is based on Wichura's algorithm AS 241 which provides
>     precise results up to about 16 digits.
> What happen after the 16th digits?

You get some rounding error:

>  print(pnorm(qnorm(1e-300)),digits=20)
[1] 9.9999999999995261e-301

> pnorm(qnorm(log(1e-300),log.p=T),log=T)/log(1e-300)-1
[1] 2.220446e-16

Of course, some of this is possibly in pnorm().

> If I am running R in a server 64-bit, can that improve the chances that 
> beyond 16th digits to still have precision?

This is on a 64-bit workstation. This version of R allows use of more 
memory, but not extended precision.

So if you need more than a 15 significant digits in your quantiles, you 
may need to do a bit more work.

And of course if your p-values are much smaller than 1e-300, you will need 
this anyway.



> Thanks,
> Aldi
> --
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

More information about the R-help mailing list