[Python-bugs-list] [Bug #133297] cmath.asin is the same as cmath.asinh

noreply@sourceforge.net noreply@sourceforge.net
Tue, 20 Feb 2001 19:23:36 -0800


Bug #133297, was updated on 2001-Feb-20 11:44
Here is a current snapshot of the bug.

Project: Python
Category: Extension Modules
Status: Closed
Resolution: Fixed
Bug Group: None
Priority: 5
Submitted by: nobody
Assigned to : tim_one
Summary: cmath.asin is the same as cmath.asinh

Details: cmath.asin returns incorrect results for all arguments except 0. 
It appears that it actually returns arcsinh of its argument.

e.g. asin(2.0) gives (1.44363547518+0j) -- actually asinh(2.0) -- instead
of (pi/2-1.31695789692j).

This problem is not present in the math module.  It was also not present in
version 1.52.  It is present in version 2.0. however.  It occurs under both
NT and Windows 2000.

P.S. I object to having to upgrade to IE 5.01 to log into Sourceforge, so
no email address -- why is SSL required?

Follow-Ups:

Date: 2001-Feb-20 19:23
By: tim_one

Comment:
Closed and fixed, cmathmodule.c rev 2.23.

Here's a snippet from the after patch-version:

C:\Code\python\dist\src\PCbuild>python
Python 2.1a2 (#10, Feb 20 2001, 18:17:21) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> import cmath
>>> cmath.asin(2)
(1.57079632679-1.31695789692j)
>>> cmath.asinh(2)
(1.44363547518+0j)
>>> cmath.asinh(cmath.sinh(450))
(450+0j)
>>> cmath.asinh(1e308)
(709.889355823+0j)
>>>
-------------------------------------------------------

Date: 2001-Feb-20 18:49
By: tim_one

Comment:
OK, complex asin was destroyed in revision 2.13 of cmathmodule.c.  This was
a contributed patch that we resisted applying for a long time, but it
appeared to do more good than harm so we just did it.

The problem:  the author *intended* to improve acosh and asinh, but
mistakely put his new code for asinh into the body of asin.  The only test
he wrote up was one where he showed that the new asinh worked better *when
implemented in Python*; had nothing to do with his after-patch code.

The other problem:  I checked some of his acosh() results against Macsyma,
and was happy enough.  IIRC, I just assumed asinh() would be similar (his
writeup showed similar tests and results for both).

The real problem:  we have no test suite for cmathmodule.  Care to write
one?

And the other real problem:  cmathmodule.c is numerically naive.

I'll sort this mess out ... later.
-------------------------------------------------------

Date: 2001-Feb-20 12:38
By: tim_one

Comment:
Agree something looks fishy, but they're not the same.

About IE 5.01 and SSL, you'll have to ask SourceForge.  I'd suggest you use
Netscape if you don't want to keep current with IE.

-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=133297&group_id=5470