Skip to content
Prev 304059 / 398513 Next

R minimal calculation error

On Fri, Aug 24, 2012 at 12:48:54PM +0200, Frederik Bertling wrote:
Hi.

This is a consequence of the limited precision, which is used
for speed. Examples of this type exist also for the decimal
arithmetic. Using 3 digit precision, the arithmetic mean of
the three numbers 1.02, 1.01, 1.01 is 1.01. So, the sum of the
differences

  1.02 - 1.01
  1.01 - 1.01
  1.01 - 1.01

is not zero.

See functions zapsmall(), all.equal().

Hope this helps.

Petr Savicky.