Skip to content
Back to formatted view

Raw Message

Message-ID: <A4E5A0B016B8CB41A485FC629B633CED4A3168E2F6@GOLD.corp.lgc-group.com>
Date: 2013-01-10T14:56:00Z
From: S Ellison
Subject: Precision of values > 53 bits
In-Reply-To: <50EE9EC9.80206@atsec.com>

> I am working with large numbers and identified that R looses 
> precision for such high numbers.
Yes. R uses standard 32-bit double precision. See ?double in your R help system. And welcome to finite precision arithmetic, which is a very widely known issue in digital comuting ever since it was invented.

> Is there a solution to the problem?
"Yes, lots," said Bilbo, before he remembered not to give his friends away. "No, none at all, not one," he said immediately afterwards. [1]

R cannot easily be recompiled to use higher precision, so in that sense, 'none at all'.

However, you could use something like the Rmpfr package for arbitrary precision arithmetic.
On linux/unix you can use bc (see http://r.789695.n4.nabble.com/Arbitrary-Precision-Numbers-td855931.html)
Or you could do basic things that address the issue: for example, scale, mean-centre or transform the numbers or change your parameterisation so that you do not need high numerical precision on large numbers.


Steve Ellison

[1] JRR Tolkien, ' The Hobbit', Chapter 3 (1937) 

> 
> Thanks a lot
> Stephan
> 
> ______________________________________________
> 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.
> 

*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}