[R] Bug or inaccuracy in cumsum( )
Mai Zhou
mai at ms.uky.edu
Fri Oct 3 23:23:37 CEST 2008
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
More information about the R-help
mailing list