Message-ID: <4B4B4CE2.8060603@gmail.com>
Date: 2010-01-11T16:08:02Z
From: Magnus Torfason
Subject: Strange behaviour of as.integer()
In-Reply-To: <19275.17864.762586.879061@lynne.math.ethz.ch>
On 1/11/2010 10:37 AM, Martin Maechler wrote:
> Magnus Torfason<zulutime.net at gmail.com wrote:
>> Of course there is still the problem that:
>> > 1+1 == sqrt(2)*sqrt(2)
>> [1] FALSE
>> and gmp will not solve this . I don't know if there is an R-package for
>> arbitrary-precision reals floating around, but probably not.
>
> Yes, there's package 'Rmpfr' for arbitrary precision
> floating-point, written and maintained by me.
>
> However, that does *still* not allow the equivalent
> of
> 1+1 == sqrt(2)*sqrt(2)
>
> because that would need *infinite* precision not just arbitrary
> precision, or then *symbolic* computation, as I assume the following does
Very true! I got my jargon mixed up. I was in fact referring to symbolic
computation when i wrote that. In the meantime I had found the Rmpfr
package, which installed from CRAN without a hitch on my Windows Vista
computer. Nevertheless, I look forward to receiving the latest update
once it propagates through CRAN.
I think the gmp and Rmpfr packages need more airtime in R circles, since
issues of precision come up all the time and they provide a very
straight-forward way of addressing the issue. Perhaps they should be
added to FAQ 7.31?
Best,
Magnus