Re: [R] Strange behaviour of as.integer()

2010-01-11 Thread Magnus Torfason
On 1/11/2010 10:37 AM, Martin Maechler wrote: Magnus Torfason 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 pac

Re: [R] Strange behaviour of as.integer()

2010-01-11 Thread Martin Maechler
> "MT" == Magnus Torfason > on Thu, 07 Jan 2010 10:01:28 -0500 writes: MT> There have been some really great responses to this question. I would MT> like to make a minor contribution by throwing the 'gmp' package into the MT> mix. MT> On 1/7/2010 8:12 AM, Duncan Mu

Re: [R] Strange behaviour of as.integer()

2010-01-11 Thread Ulrich Keller
I would like to thank all those who wrote helpful and interesting replies to my question. I could have saved myself the time for writing it up had I simply read ?as.integer. However, under the circumstances in which I first encountered as.integer's truncating behaviour this was not so obvious becau

Re: [R] Strange behaviour of as.integer()

2010-01-08 Thread Ted Harding
See below. >> From: r-help-boun...@r-project.org >> [mailto:r-help-boun...@r-project.org] On Behalf Of Ulrich Keller >> Sent: Thursday, January 07, 2010 4:32 AM >> To: r-help@r-project.org >> Subject: [R] Strange behaviour of as.integer() >> >>

Re: [R] Strange behaviour of as.integer()

2010-01-07 Thread William Dunlap
.org] On Behalf Of Ulrich Keller > Sent: Thursday, January 07, 2010 4:32 AM > To: r-help@r-project.org > Subject: [R] Strange behaviour of as.integer() > > I have encountered a strange behaviour of as.integer() which does not > seem correct to me. Sorry if this is just an indication o

Re: [R] Strange behaviour of as.integer()

2010-01-07 Thread Magnus Torfason
There have been some really great responses to this question. I would like to make a minor contribution by throwing the 'gmp' package into the mix. On 1/7/2010 8:12 AM, Duncan Murdoch wrote: On 07/01/2010 7:31 AM, Ulrich Keller wrote: as.integer(.57 * 100) [1] 56 Yes, as the man page state

Re: [R] Strange behaviour of as.integer()

2010-01-07 Thread Ted Harding
On 07-Jan-10 12:31:42, Ulrich Keller wrote: > I have encountered a strange behaviour of as.integer() which > does not seem correct to me. Sorry if this is just an indication > of me not understanding floating point arithmetic. I'm afraid it probably is -- but being aware of what the problem is, is

Re: [R] Strange behaviour of as.integer()

2010-01-07 Thread David Winsemius
On Jan 7, 2010, at 7:31 AM, Ulrich Keller wrote: I have encountered a strange behaviour of as.integer() which does not seem correct to me. Sorry if this is just an indication of me not understanding floating point arithmetic. .57 * 100 [1] 57 .29 * 100 [1] 29 So far, so good. But: as.in

Re: [R] Strange behaviour of as.integer()

2010-01-07 Thread Duncan Murdoch
On 07/01/2010 7:31 AM, Ulrich Keller wrote: I have encountered a strange behaviour of as.integer() which does not seem correct to me. Sorry if this is just an indication of me not understanding floating point arithmetic. .57 * 100 [1] 57 .29 * 100 [1] 29 So far, so good. But: as.integer(.

[R] Strange behaviour of as.integer()

2010-01-07 Thread Ulrich Keller
I have encountered a strange behaviour of as.integer() which does not seem correct to me. Sorry if this is just an indication of me not understanding floating point arithmetic. > .57 * 100 [1] 57 > .29 * 100 [1] 29 So far, so good. But: > as.integer(.57 * 100) [1] 56 > as.integer(.29 * 100) [1]