[Swift-devel] assertEqual
Mihael Hategan
hategan at mcs.anl.gov
Mon Apr 6 12:14:23 CDT 2015
On Mon, 2015-04-06 at 09:38 -0500, Tim Armstrong wrote:
> Right, the tests for those things in the Swift test suite are like:
>
> assert(abs(sin(PI/2) - 1.0) < 1e-15, "sin");
>
> Which is a little less convenient.
>
> I think if we want almost equal semantics we could have assertAlmostEqual
> with a tolerance parameter
That's a choice.
I personally think that approximate equality in numerics is such a
widespread issue, that there wouldn't be much confusion.
Mihael
>
> -Tim
>
> On 5 April 2015 at 21:17, Mihael Hategan <hategan at mcs.anl.gov> wrote:
>
> > Hi,
> >
> > I found it useful to have a tolerance parameter for assertEqual(float,
> > float).
> >
> > Checks like assertEqual(tan(x), sin(x) / cos(x)) are otherwise not going
> > to work very well.
> >
> > Mihael
> >
> > _______________________________________________
> > Swift-devel mailing list
> > Swift-devel at ci.uchicago.edu
> > https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel
> >
More information about the Swift-devel
mailing list