Displaying 20 results from an estimated 20000 matches similar to: "Infinite != NaN?"
2017 Apr 01
1
mean(x) != mean(rev(x)) different with x <- c(NA, NaN) for some builds
On Fri, Mar 31, 2017 at 10:14 PM, Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote:
> From ?NA
>
> Numerical computations using ?NA? will normally result in ?NA?: a
> possible exception is where ?NaN? is also involved, in which case
> either might result.
>
> and ?NaN
>
> Computations involving ?NaN? will return ?NaN? or perhaps ?NA?:
>
1999 May 11
5
matrix() can't handle NaN (PR#193)
Full_Name: Bill Simpson
Version: 0.64.1
OS: linux
Submission from: (NULL) (193.62.250.209)
Here is the data file:
x y z
1 1 1
1 2 2
2 1 NaN
2 2 4
>data<-read.table("~/junk.dat",header=TRUE)
> data
x y z
1 1 1 1
2 1 2 2
3 2 1 NaN
4 2 2 4
> matrix(data$z,length(y),length(x))
[,1] [,2]
[1,] 1 4
[2,] 2 3
This is not the correct matrix. It seems
2012 Jul 31
3
Help with NaN when 0 divided by 0
Hi All,
I have some data where I am doing fairly simple calculations, nothing more
than adding, subtracting, multiplying and dividing.
I’m running into a problem when I divide one variable by another and when
they’re both 0 I get NaN. I realize that if you divide a non-zero by 0 then
you get Inf, which is, of course, correct. But in my case I never get Inf,
just NaN because of the structure
2010 Oct 01
4
cleaning up a vector
I calculated a large vector. Unfortunately, I have some measurement error
in my data and some of the values in the vector are erroneous. I ended up
wih some Infs and NaNs in the vector. I would like to filter out the Inf
and NaN values and only keep the values in my vector that range from 1 to
20. Is there a way to filter out Infs and NaNs in R and end up with a
clean vector?
Mike
2011 May 26
2
NaN, Inf to NA
Hi,
I want to recode all Inf and NaN values to NA, but I;m surprised to see the
result of the following code. Could anybody enlighten me about this?
> df <- data.frame(a=c(NA, NaN, Inf, 1:3))
> df[is.infinite(df) | is.nan(df)] <- NA
> df
a
1 NA
2 NaN
3 Inf
4 1
5 2
6 3
>
Thanks!
Cheers!!
Albert-Jan
2011 May 26
2
NaN, Inf to NA
Hi,
I want to recode all Inf and NaN values to NA, but I;m surprised to see the
result of the following code. Could anybody enlighten me about this?
> df <- data.frame(a=c(NA, NaN, Inf, 1:3))
> df[is.infinite(df) | is.nan(df)] <- NA
> df
a
1 NA
2 NaN
3 Inf
4 1
5 2
6 3
>
Thanks!
Cheers!!
Albert-Jan
2010 May 13
1
results of pnorm as either NaN or Inf
I stumbled across this and I am wondering if this is unexpected behavior
or if I am missing something.
> pnorm(-1.0e+307, log.p=TRUE)
[1] -Inf
> pnorm(-1.0e+308, log.p=TRUE)
[1] NaN
Warning message:
In pnorm(q, mean, sd, lower.tail, log.p) : NaNs produced
> pnorm(-1.0e+309, log.p=TRUE)
[1] -Inf
I don't know C and am not that skilled with R, so it would be hard for me
to look into
2024 Sep 06
1
BUG: atan(1i) / 5 = NaN+Infi ?
I expect that atan(1i) = (0 + infinity i) and that atan(1i)/5 = (0 +
infinity i)/5 = (0 + infinity i).
Here's what I get in C:
(0,1) = (0, 1)
atan((0,1)) = (0, inf)
atan((0,1))/5 = (0, inf)
Note the difference between I*infinity = (0,1)*infinity =
(0*infinity,1*infinity) = (NaN,infinity)
and (0,infinity)/5 = (0/5,infinity/5) = (0,infinity).
The former involves multiplying 0 by infinity, which
2015 Nov 30
1
Inconsistency in treating NaN-results?
As a side note, Splus makes sin(x) NA, with a warning, for
abs(x)>1.6*2^48 (about
4.51e+14) because more than half the digits are incorrect in sin(x)
for such x. E.g.,
in R we get:
> options(digits=16)
> library(Rmpfr)
> sin(4.6e14)
[1] -0.792253849684354
> sin(mpfr(4.6e14, precBits=500))
1 'mpfr' number of precision 500 bits
[1]
2015 Nov 26
2
Inconsistency in treating NaN-results?
This question is more out of curiosity than a complaint or suggestion, but
I'm just wondering.
The behavior of R on calculations that result in NaN seems a bit
inconsistent.
# this is expected:
> 0/0
[1] NaN
# but this gives a warning
> sin(Inf)
[1] NaN
Warning message:
In sin(Inf) : NaNs produced
# and this again does not
> exp(NaN)
[1] NaN
Conceptually, I like to think that R
2009 Jan 29
1
Arima_Like() and NaN - a (possible) problem, a patch, and RFC
Hi,
recently I have started working with R (v. 2.7.2), and I have been using
R's internal ARIMA_Like() function (from the "stats" package) to
estimate some ARIMA models. In particular, I use ARIMA_Like() in a
function "fn()" that I feed to the optim() method; the main goal is to
find optimal ARIMA prediction models for some time series.
The ARIMA_Like() function returns a
2022 Nov 09
1
det(diag(c(NaN, 1))) should be NaN, not 0
Hello,
Currently, determinant(A) calculates the determinant of 'A' by factorizing
A=LU and computing prod(diag(U)) [or the logarithm of the absolute value].
The factorization is done by LAPACK routine DGETRF, which gives a status
code INFO, documented [1] as follows:
*> INFO is INTEGER
*> = 0: successful exit
*> < 0: if INFO = -i, the i-th
2024 Sep 06
1
BUG: atan(1i) / 5 = NaN+Infi ?
On 2024-09-06 12:44 a.m., Richard O'Keefe wrote:
> I expect that atan(1i) = (0 + infinity i) and that atan(1i)/5 = (0 +
> infinity i)/5 = (0 + infinity i).
> Here's what I get in C:
> (0,1) = (0, 1)
> atan((0,1)) = (0, inf)
> atan((0,1))/5 = (0, inf)
>
> Note the difference between I*infinity = (0,1)*infinity =
> (0*infinity,1*infinity) = (NaN,infinity)
> and
2024 Sep 05
2
BUG: atan(1i) / 5 = NaN+Infi ?
Perhaps
> Inf*1i
[1] NaN+Infi
clarifies why it is *not* a bug.
(Boy, did that jog some long dusty math memories :-) )
-- Bert
On Thu, Sep 5, 2024 at 2:48?PM Duncan Murdoch <murdoch.duncan at gmail.com>
wrote:
> On 2024-09-05 4:23 p.m., Leo Mada via R-help wrote:
> > Dear R Users,
> >
> > Is this desired behaviour?
> > I presume it's a bug.
> >
2024 Sep 06
1
BUG: atan(1i) / 5 = NaN+Infi ?
G.5.1 para 2 can be found in the C17 standard -- I actually have the
final draft not the published standard. It's in earlier standards, I
just didn't check earlier standards. Complex arithmetic was not in
the first C standard (C89) but was in C99.
The complex numbers do indeed form a field, and Z*W invokes an
operation in that field when Z and W are both complex numbers. Z*R
and R*Z,
2018 Mar 05
2
how to simplify FP ops with an undef operand?
On 05.03.2018 19:27, Sanjay Patel via llvm-dev wrote:
> 3. fadd C, undef --> undef (where C is not NaN or Inf)
> In the general constant case, the result could be anything as long as
> constant operand C is not NaN or Inf.
If C is the largest finite positive number, then (fadd C, X) cannot be a
finite negative number. So doesn't folding (fadd C, undef) --> undef
break the
2011 Sep 20
1
randomForest - NaN in %IncMSE
Hi
I am having a problem using varImpPlot in randomForest. I get the error
message "Error in plot.window(xlim = xlim, ylim = ylim, log = "") : need
finite 'xlim' values"
When print $importance, several variables have NaN under %IncMSE. There
are no NaNs in the original data. Can someone help me figure out what is
happening here?
Thanks!
[[alternative HTML
2010 Mar 31
2
Should as.complex(NaN) -> NA?
I'm having trouble grokking complex NaN's.
This first set examples using complex(re=NaN,im=NaN)
give what I expect
> Re(complex(re=NaN, im=NaN))
[1] NaN
> Im(complex(re=NaN, im=NaN))
[1] NaN
> Arg(complex(re=NaN, im=NaN))
[1] NaN
> Mod(complex(re=NaN, im=NaN))
[1] NaN
> abs(complex(re=NaN, im=NaN))
[1] NaN
and so do the following
> Re(complex(re=1,
2010 Aug 27
3
predict.loess and NA/NaN values
Hi!
In a current project, I am fitting loess models to subsets of data in
order to use the loess predicitons for normalization (similar to what
is done in many microarray analyses). While working on this I ran into
a problem when I tried to predict from the loess models and the data
contained NAs or NaNs. I tracked down the problem to the fact that
predict.loess will not return a value at all
2010 Sep 21
3
bivariate vector numerical integration with infinite range
Dear list,
I'm seeking some advice regarding a particular numerical integration I
wish to perform.
The integrand f takes two real arguments x and y and returns a vector
of constant length N. The range of integration is [0, infty) for x and
[a,b] (finite) for y. Since the integrand has values in R^N I did not
find a built-in function to perform numerical quadrature, so I wrote
my own after