<div dir="ltr"><div><div>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></div><div>Which is a little less convenient.<br></div><div><br></div>I think if we want almost equal semantics we could have assertAlmostEqual with a tolerance parameter<br><br></div>-Tim<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 5 April 2015 at 21:17, 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">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 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">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>
</blockquote></div><br></div>