Bug?

deed via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 23 10:11:09 PDT 2014


> --
>
> Why bother?
>
> import std.algorithm : max;
>
> F fun (F a, F b) { return max(a,b) + 1.; }
> unittest { assert (gun(1, 2) == gun(2, 1)); } // Passes
>
> F pun (F a, F b) { return sin(max(a,b)); }
> unittest { assert (fun(1, 2) == fun(2, 1)); } // Fails

// Fun, gun, pun...
unittest { assert (fun(1, 2) == fun(2, 1)); } // Passes
unittest { assert (pun(1, 2) == pun(2, 1)); } // Fails


More information about the Digitalmars-d-learn mailing list