[Numpy-discussion] what goes wrong with cos(), sin()

Anne Archibald peridot.faceted at gmail.com
Wed Feb 21 13:29:24 EST 2007


On 21/02/07, Zachary Pincus <zpincus at stanford.edu> wrote:

> A corrolary: in general do not two floating-point values for equality
> -- use something like numpy.allclose. (Exception -- equality is
> expected if the exact sequence of operations to generate two numbers
> were identical.)

I really can't agree that blindly using allclose() is a good idea. For
example, allclose(plancks_constant,0) and the difference leads to
quantum mechanics... you really have to know how much difference you
expect and how big your numbers are going to be.

Anne



More information about the NumPy-Discussion mailing list