can you explain that a little more detailed?
Perhaps I miss the background knowledge - but it seems just absurd
to me.
0.1+0.1+0.1 is 0.3 - there is no rounding involved, is there?
why is
x - 0.1 + 0.1 +0.1
not equal to
y - 0.3
Remember that this is in BINARY arithmetic. It's
Hi,
Today I was flabbergasted to see something that looks like a rounding
error in the very basic seq function in R.
a = seq(0.1,0.9,by=0.1)
a
[1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
a[1] == 0.1
[1] TRUE
a[2] == 0.2
[1] TRUE
a[3] == 0.3
[1] FALSE
It turns out that the alternative
a =
On 9/30/2009 2:40 PM, Michael Knudsen wrote:
Hi,
Today I was flabbergasted to see something that looks like a rounding
error in the very basic seq function in R.
a = seq(0.1,0.9,by=0.1)
a
[1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
a[1] == 0.1
[1] TRUE
a[2] == 0.2
[1] TRUE
a[3] == 0.3
[1]
On Wed, Sep 30, 2009 at 8:44 PM, Duncan Murdoch murd...@stats.uwo.ca wrote:
Why? You asked for an increment of 1 in the second case (which is exactly
represented in R), then divided by 10, so you'll get the same as 0.3 gives
you. In the seq() case you asked for an increment of a number close
To: Duncan Murdoch
Cc: r help
Subject: Re: [R] Rounding error in seq(...)
On Wed, Sep 30, 2009 at 8:44 PM, Duncan Murdoch murd...@stats.uwo.ca
wrote:
Why? You asked for an increment of 1 in the second case (which is exactly
represented in R), then divided by 10, so you'll get the same as 0.3
On 9/30/2009 2:50 PM, Michael Knudsen wrote:
On Wed, Sep 30, 2009 at 8:44 PM, Duncan Murdoch murd...@stats.uwo.ca wrote:
Why? You asked for an increment of 1 in the second case (which is exactly
represented in R), then divided by 10, so you'll get the same as 0.3 gives
you. In the seq() case
hum,
can you explain that a little more detailed?
Perhaps I miss the background knowledge - but it seems just absurd to
me.
0.1+0.1+0.1 is 0.3 - there is no rounding involved, is there?
why is
x - 0.1 + 0.1 +0.1
not equal to
y - 0.3
?
Am 30.09.2009 um 21:04 schrieb Duncan Murdoch:
On
On Wed, Sep 30, 2009 at 8:40 PM, Michael Knudsen micknud...@gmail.com wrote:
a = seq(0.1,0.9,by=0.1)
a
[1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
a[1] == 0.1
[1] TRUE
a[2] == 0.2
[1] TRUE
a[3] == 0.3
[1] FALSE
A friend of mine just pointed out a possible solution:
a=seq(0.1,0.9,by=0.1)
On 9/30/2009 3:17 PM, Martin Batholdy wrote:
hum,
can you explain that a little more detailed?
Perhaps I miss the background knowledge - but it seems just absurd to
me.
0.1+0.1+0.1 is 0.3 - there is no rounding involved, is there?
R uses a binary floating point storage format, which is
On 1/10/2009, at 8:17 AM, Martin Batholdy wrote:
hum,
can you explain that a little more detailed?
Perhaps I miss the background knowledge - but it seems just absurd to
me.
0.1+0.1+0.1 is 0.3 - there is no rounding involved, is there?
why is
x - 0.1 + 0.1 +0.1
not equal to
y - 0.3
?
You
Martin Batholdy wrote:
hum,
can you explain that a little more detailed?
Perhaps I miss the background knowledge - but it seems just absurd to me.
0.1+0.1+0.1 is 0.3 - there is no rounding involved, is there?
why is
x - 0.1 + 0.1 +0.1
not equal to
y - 0.3
Remember that this is in BINARY
-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Martin Batholdy
Sent: Wednesday, September 30, 2009 12:18 PM
To: Duncan Murdoch
Cc: r help
Subject: Re: [R] Rounding error in seq(...)
hum,
can you explain that a little
...@r-
project.org] On Behalf Of Martin Batholdy
Sent: Wednesday, September 30, 2009 1:18 PM
To: Duncan Murdoch
Cc: r help
Subject: Re: [R] Rounding error in seq(...)
hum,
can you explain that a little more detailed?
Perhaps I miss the background knowledge - but it seems just absurd
See:
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f
On Wed, Sep 30, 2009 at 2:40 PM, Michael Knudsen micknud...@gmail.com wrote:
Hi,
Today I was flabbergasted to see something that looks like a rounding
error in the very basic seq function
Martin Batholdy wrote:
hum,
can you explain that a little more detailed?
Perhaps I miss the background knowledge - but it seems just absurd to
me.
0.1+0.1+0.1 is 0.3 - there is no rounding involved, is there?
Unfortunately this comes as an utter shock to many people who never
For my own edification more than anything (I never took computer science): is
a = seq(0.1,0.9,by=0.1)
a - as.character(a)
a[3] == 0.3
[1] TRUE
safe?
-Ista
On Wed, Sep 30, 2009 at 3:46 PM, cls59 ch...@sharpsteen.net wrote:
Martin Batholdy wrote:
hum,
can you explain that a little more
On 9/30/2009 3:59 PM, Ista Zahn wrote:
For my own edification more than anything (I never took computer science): is
a = seq(0.1,0.9,by=0.1)
a - as.character(a)
a[3] == 0.3
[1] TRUE
safe?
No. Someone might be in a locale where the comma is used as the decimal
separator. Take a look at
On 30-Sep-09 19:32:46, Peter Dalgaard wrote:
Martin Batholdy wrote:
hum,
can you explain that a little more detailed?
Perhaps I miss the background knowledge - but it seems just absurd to
me.
0.1+0.1+0.1 is 0.3 - there is no rounding involved, is there?
why is
x - 0.1 + 0.1 +0.1
not
On Wed, Sep 30, 2009 at 2:32 PM, Peter Dalgaardp.dalga...@biostat.ku.dk wrote:
Martin Batholdy wrote:
hum,
can you explain that a little more detailed?
Perhaps I miss the background knowledge - but it seems just absurd to me.
0.1+0.1+0.1 is 0.3 - there is no rounding involved, is there?
On Sep 30, 2009, at 6:05 PM, Douglas Bates wrote:
On Wed, Sep 30, 2009 at 2:32 PM, Peter Dalgaardp.dalga...@biostat.ku.dk
wrote:
Martin Batholdy wrote:
hum,
can you explain that a little more detailed?
Perhaps I miss the background knowledge - but it seems just absurd
to me.
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Douglas Bates
Sent: Wednesday, September 30, 2009 3:06 PM
To: Peter Dalgaard
Cc: r help; Duncan Murdoch
Subject: Re: [R] Rounding error in seq(...)
On Wed, Sep 30, 2009 at 2
In an earlier thread on this theme I believe that someone quoted Brian
Kernighan as saying 10 times 0.1 is hardly ever 1 but I haven't been
able to track down the quote. Can anyone point us to such a quote?
It summarizes the situation succinctly,
See FAQ 7.31 :)
Nordlund, Dan (DSHS/RDA) wrote:
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Douglas Bates
Sent: Wednesday, September 30, 2009 3:06 PM
To: Peter Dalgaard
Cc: r help; Duncan Murdoch
Subject: Re: [R] Rounding error in seq
-Original Message-
From: Peter Dalgaard [mailto:p.dalga...@biostat.ku.dk]
Sent: Wednesday, September 30, 2009 3:58 PM
To: Nordlund, Dan (DSHS/RDA)
Cc: Douglas Bates; r help
Subject: Re: [R] Rounding error in seq(...)
snip
The first page of this document references:
http
24 matches
Mail list logo