<div dir="ltr">On Sun, Jan 18, 2015 at 11:27 AM, Ron Adam <span dir="ltr"><<a href="mailto:ron3200@gmail.com" target="_blank">ron3200@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><span class=""></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""></span>
I'm going to try to summarise what I got out of this discussion. Maybe it will help bring some focus to the topic.<br>
<br>
I think there are two case's to consider.<br>
<br>
# The most common case.<br></blockquote><div><br></div><div>why do you think this is the most common case?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
rel_is_good(actual, expected, delta) # value +- %delta.<br>
<br>
# Testing for possible equivalence?<br>
rel_is_close(value1, value2, delta) # %delta close to each other.<br>
<br>
I don't think they are quite the same thing.<br>
<br>
rel_is_good(9, 10, .1) --> True<br>
rel_is_good(10, 9, .1) --> False<br>
<br>
rel_is_close(9, 10, .1) --> True<br>
rel_is_close(10, 9, .1) --> True<br></blockquote><div><br></div><div>agreed -- they are not the same thing. But I'm not convinced that they are all that different from a practical perspective -- 0.1 is a very large relative tolerance (I wouldn't cal it delta for a relative measure) if you use a more-common, much smaller tolerance (1e-8 -- 1e-12 maybe?) then the difference between these becomes pretty minimal. And for the most part, this kind of testing is looking for an "approximation" -- so you can't get really upset about exactly where the cut-off is.<br><br></div><div>Though, given my thoughts on that, I suppose if other people want to be able to clearly specify which of the two values should be used to scale "relative", then it won't make much difference anyway.<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The next issue is, where does the numeric accuracy of the data, significant digits, and the languages accuracy (ULPs), come into the picture.<br>
<br>
My intuition.. I need to test the idea to make a firmer claim.. is that in the case of is_good, you want to exclude the uncertain parts, but with is_close, you want to include the uncertain parts.<br></blockquote><div><br></div><div>I think this is pretty irrelevant -- you can't do better than the precession of the data type, doesn't make a difference which definition you are using -- they only change which value is used to scale relative.<br><br></div><div>There are cases where ULPs, etc are key -- those are for testing precision of algorithms, etc, and I think a special use case that would require a different function -- no need to try to cram it all into one function.<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Two values "are close" if you can't tell one from the other with certainty. The is_close range includes any uncertainty.<br></blockquote><div><br></div><div>I think "uncertainly" is entirely use-case dependent -- floating point calculations are not uncertain -- with a defined rounding procedure, etc, they are completely deterministic. IT can often make things easier to think about if you think of the errors as random, but they are, in fact, not random. And if you care about the precision down to close to limits of representation, then you care about ULPS, etc, and you'd better be reasoning about the errors carefully.<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is where taking in consideration of an absolute delta comes in. The minimum range for both is the uncertainty of the data. But is_close and is_good do different things with it.<br></blockquote><div><br></div><div>an absolute delta is simply a different use-case -- sometimes you know exactly how much difference you care about, and sometimes you only care that the numbers are relatively close (or, in any case, you need to test a wide variety of magnitudes of numbers, so don't want to have to calculate the absolute delta for each one). This is akin to saying that the numbers are the same to a certain number of significant figures -- a common and usefull way to think about it.<br> </div>-Chris<br><br clear="all"></div><br>-- <br><div class="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R (206) 526-6959 voice<br>7600 Sand Point Way NE (206) 526-6329 fax<br>Seattle, WA 98115 (206) 526-6317 main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div></div>