Others explained why it happens, but you might want to look at the
zapsmall function for one way to deal with it.
On Thu, Mar 1, 2012 at 2:49 PM, Mark A. Albins wrote:
> Hi!
>
> I'm running R version 2.13.0 (2011-04-13)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> When i type in the command:
>
>
On Thu, Mar 01, 2012 at 04:55:55PM -0500, Sarah Goslee wrote:
> Of course there's rounding error: your computer can't
> store those decimal numbers precisely. See R FAQ 7.31 for
> details.
>
> See also:
> sum(10*c(-0.2, 0.8, 0.8, -3.2, 1.8)) / 10
Hi.
This is 0. This works without rounding for on
On Thu, Mar 01, 2012 at 01:49:44PM -0800, Mark A. Albins wrote:
> Hi!
>
> I'm running R version 2.13.0 (2011-04-13)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> When i type in the command:
>
> sum(c(-0.2, 0.8, 0.8, -3.2, 1.8))
>
> R returns the value:
>
> -5.551115e-17
>
> Why doesn't R retu
p-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of Mark A. Albins
> Sent: Thursday, March 01, 2012 1:50 PM
> To: r-help@r-project.org
> Subject: [R] problem with sum function
>
> Hi!
>
> I'm running R version 2.13.0 (2011-04-13)
> Platform: i38
Of course there's rounding error: your computer can't
store those decimal numbers precisely. See R FAQ 7.31 for
details.
See also:
sum(10*c(-0.2, 0.8, 0.8, -3.2, 1.8)) / 10
Sarah
On Thu, Mar 1, 2012 at 4:49 PM, Mark A. Albins wrote:
> Hi!
>
> I'm running R version 2.13.0 (2011-04-13)
> Platform
Hi!
I'm running R version 2.13.0 (2011-04-13)
Platform: i386-pc-mingw32/i386 (32-bit)
When i type in the command:
sum(c(-0.2, 0.8, 0.8, -3.2, 1.8))
R returns the value:
-5.551115e-17
Why doesn't R return zero in this case? There shouldn't be any rounding
error in a simple sum.
Thanks,
M
6 matches
Mail list logo