<div dir="ltr"><div>That might not actually work in Swift/T since we don't support overloading in combination with optional args.<br><br></div><div><br></div>- Tim<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 8 April 2015 at 13:57, Tim Armstrong <span dir="ltr"><<a href="mailto:tim.g.armstrong@gmail.com" target="_blank">tim.g.armstrong@gmail.com</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">So assertEqual(float, float, string, float tolerance=0.0) ?<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 8 April 2015 at 13:08, Mihael Hategan <span dir="ltr"><<a href="mailto:hategan@mcs.anl.gov" target="_blank">hategan@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I went with an optional. It keeps backwards compatibility and makes it<br>
clear what that number is.<br>
<span><font color="#888888"><br>
Mihael<br>
</font></span><div><div><br>
On Wed, 2015-04-08 at 11:48 -0500, Tim Armstrong wrote:<br>
> Reviving this thread... Probably the options are to either add an overload:<br>
><br>
> assertEqual(float v1, float v2, float tolerance, string msg)<br>
><br>
> or something like<br>
><br>
> assertAlmostEqual(float v1, float v2, float tolerance, string msg)<br>
> assertApproxEqual(float v1, float v2, float tolerance, string msg)<br>
> assertApprox(float v1, float v2, float tolerance, string msg)<br>
><br>
> I don't think there's much of a reason to break compatibility in Swift/T<br>
> with the (float, float, string) form, so I think we should keep that in.<br>
><br>
> - Tim<br>
><br>
> On 6 April 2015 at 12:14, Mihael Hategan <<a href="mailto:hategan@mcs.anl.gov" target="_blank">hategan@mcs.anl.gov</a>> wrote:<br>
><br>
> > On Mon, 2015-04-06 at 09:38 -0500, Tim Armstrong wrote:<br>
> > > Right, the tests for those things in the Swift test suite are like:<br>
> > ><br>
> > > assert(abs(sin(PI/2) - 1.0) < 1e-15, "sin");<br>
> > ><br>
> > > Which is a little less convenient.<br>
> > ><br>
> > > I think if we want almost equal semantics we could have assertAlmostEqual<br>
> > > with a tolerance parameter<br>
> ><br>
> > That's a choice.<br>
> ><br>
> > I personally think that approximate equality in numerics is such a<br>
> > widespread issue, that there wouldn't be much confusion.<br>
> ><br>
> > Mihael<br>
> ><br>
> > ><br>
> > > -Tim<br>
> > ><br>
> > > On 5 April 2015 at 21:17, Mihael Hategan <<a href="mailto:hategan@mcs.anl.gov" target="_blank">hategan@mcs.anl.gov</a>> wrote:<br>
> > ><br>
> > > > Hi,<br>
> > > ><br>
> > > > I found it useful to have a tolerance parameter for assertEqual(float,<br>
> > > > float).<br>
> > > ><br>
> > > > Checks like assertEqual(tan(x), sin(x) / cos(x)) are otherwise not<br>
> > going<br>
> > > > to work very well.<br>
> > > ><br>
> > > > Mihael<br>
> > > ><br>
> > > > _______________________________________________<br>
> > > > Swift-devel mailing list<br>
> > > > <a href="mailto:Swift-devel@ci.uchicago.edu" target="_blank">Swift-devel@ci.uchicago.edu</a><br>
> > > > <a href="https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel" target="_blank">https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel</a><br>
> > > ><br>
> ><br>
> ><br>
> ><br>
<br>
<br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>