I would like to control how Equal[] works and allow a certain error associated with it. I would like numerical values which are, say, within one-thousandth of one another to be considered the same.
For example, I would like
1.001 == 1.00
(*True*)
I've tried the following - but I'm worried this might not be possible.
SetPrecision[1.0000 == 1.0001, 2]
(* False *)
SetAccuracy[1.0000 == 1.0001, 2]
(* False *)
Block[{Internal`$EqualTolerance = Log10[2.^28]},
Print[1.0001 == 1.000];
];
(* False *)
a == b
– Bob Hanlon May 18 '20 at 01:27evaluates toTrueorSetPrecision[Hold[1.0000 == 1.0001], 2] // ReleaseHold`Block[{Internal`$EqualTolerance = Log10[2.^53/10^4]}, 1.0001 == 1.000]– Michael E2 May 18 '20 at 01:54Block[{Internal`$EqualTolerance = Log10[2.^53/Max[1.0001, 1.000]/10^4]}, 1.0001 == 1.000]– Michael E2 May 18 '20 at 02:02