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

Anne Archibald peridot.faceted@gmail....
Wed Feb 21 12:29:24 CST 2007


On 21/02/07, Zachary Pincus <zpincus@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