> I get an incorrect result for
>
> (41/10-1/10)%%1
>
> [1] 1
Note that due to rounding errors, 41/10-1/10 is
formatC(41/10-1/10, digits=20) # [1] "3.9995559"
Besides FAQ 7.31, related information may be found also at
http://wiki.r-project.org/rwiki/doku.php?id=misc:r_accuracy
Good morning Jan,
Could this be covered off by the following?
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f
Kind regards,
Sean
On Sat, Aug 1, 2009 at 9:05 PM, wrote:
> Full_Name: jan hattendorf
> Version: 2.9.0
> OS: XP
> Submission from: (NU
Onderwerp: [Rd] incorrect result (41/10-1/10)%%1 (PR#13863)
Full_Name: jan hattendorf
Version: 2.9.0
OS: XP
Submission from: (NULL) (213.3.108.185)
I get an incorrect result for
(41/10-1/10)%%1
[1] 1
The error did not occur with other numbers than 41 (1, 11, 21, 31, 51,
...)
test <- rep(NA, 1
Not a bug, just a FAQ (7.31).
http://CRAN.R-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f
On Sat, 1 Aug 2009, jan.hattend...@unibas.ch wrote:
Full_Name: jan hattendorf
Version: 2.9.0
OS: XP
Submission from: (NULL) (213.3.108.185)
I get an incorrect result
jan.hattend...@unibas.ch wrote:
> Full_Name: jan hattendorf
> Version: 2.9.0
> OS: XP
> Submission from: (NULL) (213.3.108.185)
>
>
> I get an incorrect result for
>
> (41/10-1/10)%%1
>
> [1] 1
>
> The error did not occur with other numbers than 41 (1, 11, 21, 31, 51, ...)
>
>
> test <- rep(
Full_Name: jan hattendorf
Version: 2.9.0
OS: XP
Submission from: (NULL) (213.3.108.185)
I get an incorrect result for
(41/10-1/10)%%1
[1] 1
The error did not occur with other numbers than 41 (1, 11, 21, 31, 51, ...)
test <- rep(NA, 1000)
for(i in 1:1000){
test[i] <- i/10-1/10
}
test[test%%