[CF-metadata] bounds
John Caron wrote:
> I would prefer "equal within tolerence". if you need a definition of
> tolerence, i would use something like
> abs( (a-b)/b) < 1.0E-5
>
> The reason is that post processors shouldnt have to preserve floating
> point to the last bitter bit. ;^}
I disagree for a couple of reasons:
- Post processors don't have to preserve floating point to the last
bitter bit, each one just has to be consistent in changing the same
floating point value to a different floating point value. I can't
imagine any post processor (or other program) that would sometimes
change 0.66667 to 0.6666 and other times to 0.6667 (I'm just using
base 10 for illustration). As long as the same processor munges
the same floating point value in the same way, equality tests will
work OK. Some programs depend on that fact for processing missing
values for floating point.
- Approximate comparison is more complex than
abs( (a-b)/b) < 1.0E-5
in case b is identically zero, and because there is no "epsilon"
that is always appropriate for such tests. You can use an epsilon
appropriate for IEEE single precision floating point, but then you
can contrive cases where that would be wrong and exact equality
would be the only appropriate test.
I think Jonathan is right to recommend exact equality tests in this
case.
--Russ
Received on Thu May 22 2003 - 13:12:45 BST
This archive was generated by hypermail 2.3.0
: Tue Sep 13 2022 - 23:02:40 BST