[SciPy-dev] tanh(j*pi/2)

Robert Kern robert.kern@gmail....
Wed Jun 10 00:49:55 CDT 2009


On Wed, Jun 10, 2009 at 00:46, David Goldsmith<d_l_goldsmith@yahoo.com> wrote:
>
> No, this is what I meant:
>
>>>> N.allclose([N.tanh(N.pi*1j/2)],[N.inf])
> False
>>>> N.allclose([1/N.tanh(N.pi*1j/2)],[0.])
> True
>
> So in this case, one does need to reciprocate first (or am I using N.allclose wrong in the first example?)

Yes. Only inf is "close" to inf.

> I should probably 'Note' this tanh's doc (and other transcendentals that may exhibit this behavior).

<shrug> It's generic to all floating point implementations of
transcendentals. I'd prefer not to clutter up each ufunc's docs. A
section in the User's Guide about floating point arithmetic in general
might be worthwhile, though.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the Scipy-dev mailing list