[swift-evolution] implementing real (floating point) number comparison tolerance as a compiler directive.

Pyry Jahkola pyry.jahkola at iki.fi
Tue Mar 1 18:56:45 CST 2016


> ? I don't see transivity requirement broken here, because -within a comparison tolerance- they still are true.

Consider:
    a = 1.0
    b = 1.0 + 0.75 * eps
    c = 1.0 + 1.5 * eps

Now,
    abs(a - b) < eps, so a ~ b, and
    abs(b - c) < eps, so b ~ c,

but abs(a - c) > eps, so a and c are "not close".


More information about the swift-evolution mailing list