Re: [R] Integer / floating point question

2008-05-16 Thread Berwin A Turlach
G'day Brian, On Fri, 16 May 2008 19:28:59 +0100 (BST) Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > 'numeric' is a class but not a type -- so I think the FAQ is wrongly > worded but the concept is well defined Though there may be multiple definitions. :-) Reading a bit in "R Language Definit

Re: [R] Integer / floating point question

2008-05-16 Thread Prof Brian Ripley
'numeric' is a class but not a type -- so I think the FAQ is wrongly worded but the concept is well defined (despite the presence of is.numeric!) But it does not say that all such numbers can be represented exactly, and only some can. On Sat, 17 May 2008, Berwin A Turlach wrote: G'day Erik,

Re: [R] Integer / floating point question

2008-05-16 Thread Duncan Murdoch
On 5/16/2008 11:45 AM, Erik Iverson wrote: Marc - Marc Schwartz wrote: on 05/16/2008 09:56 AM Erik Iverson wrote: Dear R-help - I have thought about this question for a bit, and come up with no satisfactory answer. Say I have the numeric vector t1, given as t1 <- c(1.0, 1.5, 2.0, 2.5, 3.0

Re: [R] Integer / floating point question

2008-05-16 Thread Gabor Grothendieck
2, 2.0, 2e0 are all double while 2L is an integer. On Fri, May 16, 2008 at 10:56 AM, Erik Iverson <[EMAIL PROTECTED]> wrote: > Dear R-help - > > I have thought about this question for a bit, and come up with no > satisfactory answer. > > Say I have the numeric vector t1, given as > > t1 <- c(1.0,

Re: [R] Integer / floating point question

2008-05-16 Thread Berwin A Turlach
G'day Erik, On Fri, 16 May 2008 10:45:43 -0500 Erik Iverson <[EMAIL PROTECTED]> wrote: [...] > The help page for '%%' addresses this a bit, but then caveats it with > 'up to rounding error', which is really my question. Is there ever > 'rounding error' with 2.0 %% 1 as opposed to 2 %% 1? I am

Re: [R] Integer / floating point question

2008-05-16 Thread Erik Iverson
Marc - Marc Schwartz wrote: on 05/16/2008 09:56 AM Erik Iverson wrote: Dear R-help - I have thought about this question for a bit, and come up with no satisfactory answer. Say I have the numeric vector t1, given as t1 <- c(1.0, 1.5, 2.0, 2.5, 3.0) I simply want to reliably extract the uni

Re: [R] Integer / floating point question

2008-05-16 Thread Marc Schwartz
on 05/16/2008 09:56 AM Erik Iverson wrote: Dear R-help - I have thought about this question for a bit, and come up with no satisfactory answer. Say I have the numeric vector t1, given as t1 <- c(1.0, 1.5, 2.0, 2.5, 3.0) I simply want to reliably extract the unique integers from t1, i.e., th

[R] Integer / floating point question

2008-05-16 Thread Erik Iverson
Dear R-help - I have thought about this question for a bit, and come up with no satisfactory answer. Say I have the numeric vector t1, given as t1 <- c(1.0, 1.5, 2.0, 2.5, 3.0) I simply want to reliably extract the unique integers from t1, i.e., the vector c(1, 2, 3). This is of course sup