[Numpy-discussion] RAdian <--> degres conversion

Anne Archibald peridot.faceted@gmail....
Sun Dec 16 07:18:13 CST 2007


On 16/12/2007, Hans Meine <meine@informatik.uni-hamburg.de> wrote:

> (*: It's similar with math.hypot, which I have got to know and appreciate
> nowadays.)

I'd like to point out that math.hypot is a nontrivial function which
is easy to get wrong:

In [6]: x=1e200; y=1e200;

In [7]: math.hypot(x,y)
Out[7]: 1.414213562373095e+200

In [8]: math.sqrt(x**2+y**2)
---------------------------------------------------------------------------
<type 'exceptions.OverflowError'>         Traceback (most recent call last)

/home/peridot/<ipython console> in <module>()

<type 'exceptions.OverflowError'>: (34, 'Numerical result out of range')


Anne


More information about the Numpy-discussion mailing list