Jannis,
Not strange. Try with numbers that can be exactly represented in binary
(that's what computers use), e.g.,
a<-seq(5,70,by=5)
b<-15
a==b
or fractions,
a<-seq(1/32,14/32,by=1/32)
b<-3/32
a==b
Most decimal fractions cannot be represented exactly although a bit of
magic will display t
Hello,
That's FAQ 7.31.
Note that the increment, 0.05, is not a power of 2 so the third value of
the sequence is not exactly equal to 0.15.
Hope this helps,
Rui Barradas
Em 20-05-2013 13:36, Jannis escreveu:
Dear R users,
I ran into the strange situation where a number does not seem to e
Hi. Check R FAQ, section 7.31 Why doesn't R think these numbers are equal?
http://cran.r-project.org/doc/FAQ/R-FAQ.html
all.equal(a,b)
Andrija
On Mon, May 20, 2013 at 2:36 PM, Jannis wrote:
> Dear R users,
>
>
>
> I ran into the strange situation where a number does not seem to equal its
> v
Dear R users,
I ran into the strange situation where a number does not seem to equal
its value. Try this:
a <- seq(0.05,0.7,0.05)[3]
b <- 0.15
a == b
Should this not be TRUE? a-b yields a very small number (and not 0) so
this most probably is a numerical error, but why does seq create
4 matches
Mail list logo