Mark Dickinson added the comment: > Both are correct Well, strictly speaking only the output with positive imaginary part is correct here: the recommendations of C99 Annex G (which Python's cmath module follows) use the sign of the zero imaginary part to determine which 'side' of the branch cut the input lies on. In this case, -1.89 is interpreted as complex(-1.89, 0.0), so the imaginary part is a positive zero, and the sign of the imaginary part of the result matches that for complex(-1.89, small_and_positive).
So all four of the following are correct: >>> cmath.atanh(complex(-1.89, 0.0)) (-0.5888951591901462+1.5707963267948966j) >>> cmath.atanh(complex(-1.89, -0.0)) (-0.5888951591901462-1.5707963267948966j) >>> cmath.atanh(complex(1.89, 0.0)) (0.5888951591901462+1.5707963267948966j) >>> cmath.atanh(complex(1.89, -0.0)) (0.5888951591901462-1.5707963267948966j) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23523> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com