[Numpy-discussion] calcul of phase (dividing by 0)

Robert Kern rkern at ucsd.edu
Thu Feb 10 15:53:01 CST 2005


Andrea Riciputi wrote:
> Why not arctan2(ff.imag, ff.real)?

Yes, for the love of all that is holy, please use arctan2()!

For one thing, arctan2() solves other problems besides the divide-by-zero.

In [1]: from numarray import *

In [2]: arctan(-1/-1) == arctan(1/1)
Out[2]: True

In [3]: arctan2(-1,-1) == arctan2(1,1)
Out[3]: False

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the Numpy-discussion mailing list