Patrick and Bert,
Thank you both for you replies to my question. I see how my naïve expectations
fail to floating point arithmetic. However, I still believe there is an
underlying problem.
It seems to me that when asked,
c(7.7, 7.8, 7.9) %in% seq(4, 8, by=0.1)
[1] TRUE FALSE TRUE
R
On 15/11/2010 9:24 AM, Vadim Patsalo wrote:
Patrick and Bert,
Thank you both for you replies to my question. I see how my naïve expectations
fail to floating point arithmetic. However, I still believe there is an
underlying problem.
It seems to me that when asked,
c(7.7, 7.8, 7.9) %in%
Vadim Patsalo wrote:
Patrick and Bert,
Thank you both for you replies to my question. I see how my naïve expectations
fail to floating point arithmetic. However, I still believe there is an
underlying problem.
It seems to me that when asked,
c(7.7, 7.8, 7.9) %in% seq(4, 8, by=0.1)
[1]
Hello R-help,
I noticed the following surprising behavior when using %in% to find elements in
a vector generated using seq().
# weird!!!
c(7.7, 7.8, 7.9) %in% seq(4, 8, by=0.1)
[1] TRUE FALSE TRUE
# OK now
c(7.7, 7.8, 7.9) %in% round(seq(4, 8, by=0.1), 1)
[1] TRUE TRUE TRUE
# wait, how
Not weird at all!!! You need to understand how computers do
arithmetic. See R FAQ 7.31.
-- Bert
On Fri, Nov 12, 2010 at 10:55 AM, Vadim Patsalo patsa...@gmail.com wrote:
Hello R-help,
I noticed the following surprising behavior when using %in% to find elements
in a vector generated using
5 matches
Mail list logo