<div dir="ltr">I'm guessing this is also something that can go into math. (However, what about complex?)<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 12, 2015 at 2:23 PM, Chris Barker <span dir="ltr"><<a href="mailto:chris.barker@noaa.gov" target="_blank">chris.barker@noaa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Mon, Jan 12, 2015 at 12:04 PM, Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">So is 1e-100 close to 1e-50 with the default tolerance? What about 1e+100 and (1e+100 plus one ulp)?</div></blockquote><div><br></div></span><div>sorry I should have not specified a specific default, and/or explained more what I think it should mean.</div><div><br></div><div>But I thought the first question was "might this be a good idea for the standard library" -- and only if so, then we can work out how to do it.</div><div><br></div><div>But anyway, the while point is that it would be some version "relative error", NOT an absolute tolerance -- that is pretty easy to write.</div><div><br></div><div>See Nathaniel's note for the too many options already in numpy.</div><div><br></div><div>Nathaniel Smith wrote:</div><div><br></div><div><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="font-size:13px">Unfortunately this opens a tremendous can of worms.</span></blockquote><div><br></div></span><div>Well, yes, but something generally useful for many cases would still be nice.</div></div><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="font-size:13px">Boost has thought about this a lot and advocates a slightly different<br></span><span style="font-size:13px">definition (actually, two slightly different definitions) from any of<br></span><span style="font-size:13px">the above:<br></span><span style="font-size:13px">   </span><a href="http://www.boost.org/doc/libs/1_34_0/libs/test/doc/components/test_tools/floating_point_comparison.html" style="font-size:13px" target="_blank">http://www.boost.org/doc/libs/1_34_0/libs/test/doc/components/test_tools/floating_point_comparison.html</a><br></blockquote><div><br></div><br></span>It looks like they start with two, but end up with</div><div class="gmail_quote"><br></div><div class="gmail_quote">"the implementation is using modified version of the equations (1) and (2) where all underflow, overflow conditions could be guarded safely"<div><br></div><div>That looks good to me, and the origins in Knuth are a good sign.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-Chris</div><div><br></div><div><br></div></font></span></div><span class="">-- <br><div><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R            <a href="tel:%28206%29%20526-6959" value="+12065266959" target="_blank">(206) 526-6959</a>   voice<br>7600 Sand Point Way NE   <a href="tel:%28206%29%20526-6329" value="+12065266329" target="_blank">(206) 526-6329</a>   fax<br>Seattle, WA  98115       <a href="tel:%28206%29%20526-6317" value="+12065266317" target="_blank">(206) 526-6317</a>   main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</span></div></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)</div>
</div>