x=.94 (PR#10529)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

x=.94 (PR#10529)

jrecta
I am using R Version 2.6.2007-11-23.  I do not know if the problem exists
for other values or versions

I encountered a problem when searching for the number 0.94 and 0.95 in a
vector of values.  I illustrate it below by creating a sequence of values 2
ways and then looking for the value 0.94 (same result for 0.95).  It looks
like the vector generated by seq( ) is a bit off:

> a<-seq(.9,.95,by=.01)
> a
[1] 0.90 0.91 0.92 0.93 0.94 0.95

> b<-c(.90,.91,.92,.93,.94,.95)
> b
[1] 0.90 0.91 0.92 0.93 0.94 0.95

> a==.94
[1] FALSE FALSE FALSE FALSE FALSE FALSE
> b==.94
[1] FALSE FALSE FALSE FALSE  TRUE FALSE

> a-b
[1] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.110223e-16
[6] 1.110223e-16

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: x=.94 (PR#10529)

Peter Dalgaard
[hidden email] wrote:

> I am using R Version 2.6.2007-11-23.  I do not know if the problem exists
> for other values or versions
>
> I encountered a problem when searching for the number 0.94 and 0.95 in a
> vector of values.  I illustrate it below by creating a sequence of values 2
> ways and then looking for the value 0.94 (same result for 0.95).  It looks
> like the vector generated by seq( ) is a bit off:
>
>  
>> a<-seq(.9,.95,by=.01)
>> a
>>    
> [1] 0.90 0.91 0.92 0.93 0.94 0.95
>
>  
>> b<-c(.90,.91,.92,.93,.94,.95)
>> b
>>    
> [1] 0.90 0.91 0.92 0.93 0.94 0.95
>
>  
>> a==.94
>>    
> [1] FALSE FALSE FALSE FALSE FALSE FALSE
>  
>> b==.94
>>    
> [1] FALSE FALSE FALSE FALSE  TRUE FALSE
>
>  
>> a-b
>>    
> [1] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.110223e-16
> [6] 1.110223e-16
>
> [[alternative HTML version deleted]]
>
>  
*Sigh*

FAQ 7.31

--
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([hidden email])                  FAX: (+45) 35327907

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: x=.94 (PR#10529)

Uwe Ligges
In reply to this post by jrecta
Please do read the R FAQ:
"Why doesn't R think these numbers are equal?"

and before posting, you should have read the R FAQ:
"What is a bug?"

that points you to the former FAQ!

Uwe Ligges





[hidden email] wrote:

> I am using R Version 2.6.2007-11-23.  I do not know if the problem exists
> for other values or versions
>
> I encountered a problem when searching for the number 0.94 and 0.95 in a
> vector of values.  I illustrate it below by creating a sequence of values 2
> ways and then looking for the value 0.94 (same result for 0.95).  It looks
> like the vector generated by seq( ) is a bit off:
>
>> a<-seq(.9,.95,by=.01)
>> a
> [1] 0.90 0.91 0.92 0.93 0.94 0.95
>
>> b<-c(.90,.91,.92,.93,.94,.95)
>> b
> [1] 0.90 0.91 0.92 0.93 0.94 0.95
>
>> a==.94
> [1] FALSE FALSE FALSE FALSE FALSE FALSE
>> b==.94
> [1] FALSE FALSE FALSE FALSE  TRUE FALSE
>
>> a-b
> [1] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.110223e-16
> [6] 1.110223e-16
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel