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

Charles R Harris charlesr.harris at gmail.com
Wed Jun 10 02:16:40 EDT 2009


On Tue, Jun 9, 2009 at 11:49 PM, Robert Kern <robert.kern at gmail.com> wrote:

> On Wed, Jun 10, 2009 at 00:46, David Goldsmith<d_l_goldsmith at 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.
>

With examples, too.  And now you have one ;) Examples would help users
understand the implications of the imprecision.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20090610/0a70141c/attachment.html>


More information about the SciPy-Dev mailing list