Message74925
This is not a bug, at least in the sense that the behaviour of Python
2.6 is intentional: asin has branch cuts from 1 to infinity and -1 to -
infinity along the real axis. As explained by the note at the top of
the cmath documentation, on platforms with signed zeros (which is pretty
much all platforms these days), the sign of the imaginary part of the
argument is used to determine which side of the branch cut to use. So:
>>> import cmath
>>> cmath.asin(complex(2.0, 0.0))
(1.5707963267948966+1.3169578969248166j)
>>> cmath.asin(complex(2.0, -0.0))
(1.5707963267948966-1.3169578969248166j)
This is fairly standard practice, and usually the right thing in
applications; see the Kahan paper referred to at the bottom of the
cmath docs. It also follows the suggestions outlined in Annex G of the
C99 standard. |
|
Date |
User |
Action |
Args |
2008-10-17 17:00:21 | mark.dickinson | set | recipients:
+ mark.dickinson, christian.heimes, thor222 |
2008-10-17 17:00:21 | mark.dickinson | set | messageid: <1224262821.14.0.991623366565.issue4139@psf.upfronthosting.co.za> |
2008-10-17 17:00:20 | mark.dickinson | link | issue4139 messages |
2008-10-17 17:00:19 | mark.dickinson | create | |
|