From profjcnash at gmail.com  Fri Jul 31 14:18:51 2015
From: profjcnash at gmail.com (ProfJCNash)
Date: Fri, 31 Jul 2015 08:18:51 -0400
Subject: [Rd] equality testing, was all.equal....
Message-ID: <55BB67AB.8060406@gmail.com>

These issues have been around for many years. I've created some upset
among some programmers by using equality tests for reals (in R doubles).

However, there's a "but", and it is that I test using

  if ( (a + offset) == (b + offset) ) {    }

where offset is a number like 100.0. This is really "equality to a
scale" defined by the offset. It also seems to inhibit those who don't
know what is going on from changing a tolerance. It will, of course, be
defeated by some optimizing compilers.

I started doing this on very small computers (<4K bytes for program and
data) where I wanted to avoid lots of checks on whether a and b were
small. Then I realized it simplified code and is suitable for most tests
of equality.

It may be that an all.equal.offset() function would be useful.


Best, JN



[Rd] equality testing, was all.equal....
ProfJCNash