[R] Bug or inaccuracy in cumsum( )
Erik Iverson
iverson at biostat.wisc.edu
Sat Oct 4 00:02:52 CEST 2008
Third one this afternoon, see FAQ 7.31
Mai Zhou wrote:
> I came across this: shouldn't the last value be a more exact zero?
> It did not do that with 1 - sum( rep(0.1, 10) )
>
>
>> 1 - cumsum( rep(0.1, 10) )
> [1] 9.000000e-01 8.000000e-01 7.000000e-01 6.000000e-01 5.000000e-01
> 4.000000e-01 3.000000e-01 2.000000e-01
> [9] 1.000000e-01 1.110223e-16
>> version
> _
> platform i386-pc-mingw32
> arch i386
> os mingw32
> system i386, mingw32
> status
> major 2
> minor 7.1
> year 2008
> month 06
> day 23
> svn rev 45970
> language R
> version.string R version 2.7.1 (2008-06-23)
>
>
>
>
> best,
>
>
> Mai Z
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list