Float precision and float equality

Carl Banks pavlovevidence at gmail.com
Mon Dec 7 15:58:50 EST 2009


On Dec 7, 10:53 am, dbd <d... at ieee.org> wrote:
> On Dec 7, 4:28 am, sturlamolden <sturlamol... at yahoo.no> wrote:
>
> > ...
>
> > You don't understand this at all do you?
>
> > If you have a sine wave with an amplitude less than the truncation
> > error, it will always be approximately equal to zero.
>
> > Numerical maths is about approximations, not symbolic equalities.
>
> > > 1.0 + eps is the smallest value greater than 1.0, distinguishable from
> > > 1.0.
>
> > Which is the reason 0.5*eps*sin(x) is never distinguishable from 0.
> > ...
>
> A calculated value of 0.5*eps*sin(x) has a truncation error on the
> order of eps squared. 0.5*eps and 0.495*eps are readily distinguished
> (well, at least for values of eps << 0.01 :).
>
> At least one of us doesn't understand floating point.

You're talking about machine epsilon?  I think everyone else here is
talking about a number that is small relative to the expected smallest
scale of the calculation.


Carl Banks



More information about the Python-list mailing list