[Rd] Is it valid to do x == Inf?

2010-04-01 Thread Henrik Bengtsson
Hi, I found in a bit of code the following test for infinity: if (x == Inf) ... Is that valid, or should it be (as I always thought): if (is.infinite(x)) ...? Does it depend on whether 'x' is float or integer? My question is related to testing for missing values where is.na(x) is

Re: [Rd] Is it valid to do x == Inf?

2010-04-01 Thread Barry Rowlingson
On Thu, Apr 1, 2010 at 11:03 AM, Henrik Bengtsson h...@stat.berkeley.edu wrote: Hi, I found in a bit of code the following test for infinity:  if (x == Inf) ... Is that valid, or should it be (as I always thought):  if (is.infinite(x)) ...? Does it depend on whether 'x' is float or

Re: [Rd] Is it valid to do x == Inf?

2010-04-01 Thread Thomas Lumley
On Thu, 1 Apr 2010, Henrik Bengtsson wrote: Hi, I found in a bit of code the following test for infinity: if (x == Inf) ... Is that valid Yes, if you don't want to also include -Inf , or should it be (as I always thought): if (is.infinite(x)) ...? If you don't want to distinguish