Float precision and float equality

sturlamolden sturlamolden at yahoo.no
Sun Dec 6 16:48:24 EST 2009


On 6 Des, 21:52, r0g <aioe.... at technicalbloke.com> wrote:

> > .> Right.  Using abs(x-y) < eps is the way to go.
> > .>
> > .> Raymond
>
> > This only works when abs(x) and abs(y) are larger that eps, but not
> > too much larger.
>
> Okay, I'm confused now... I thought them being larger was entirely the
> point.

Yes. dbd got it wrong. If both a smaller than eps, the absolute
difference is smaller than eps, so they are considered equal.








More information about the Python-list mailing list