You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmath.tanh(±0+infj) and tanh(±0+nanj) should return ±0+nanj #122637
As per C11 DR#471 (accepted for C17), ctanh (0 + i NaN) and ctanh (0 + i Inf) should return 0 + i NaN (with "invalid" exception in the second case). Currently, real part is nan.
This has corresponding implications for ctan(z), as its errors and special cases are handled as if the operation is implemented by -i*ctanh(i*z).
Closed in #122638, with thanks to @skirpichev. As with #121889, I don't think this is behaviour that should be changed in a bugfix release, so it's not a candidate for backport.
Activity
pythongh-122637: fix tanh(±0+infj) and tanh(±0+nanj) to return ±0+nanj
skirpichev commentedon Aug 3, 2024
PR is ready for review: #122638
See also #121889
gh-122637: fix tanh(±0+infj) and tanh(±0+nanj) to return ±0+nanj (#12…
mdickinson commentedon Aug 4, 2024
Closed in #122638, with thanks to @skirpichev. As with #121889, I don't think this is behaviour that should be changed in a bugfix release, so it's not a candidate for backport.
skirpichev commentedon Aug 4, 2024
Great. Now glibc's libm pass cmath_testcases.txt.
One minor note, now we have slightly misleading comment:
cpython/Modules/cmathmodule.c
Lines 157 to 158 in e6fad7a
This (and fix for #121889) is available in C17, not
C11C99. Though, as you can see, glibc turns this on unconditionally.Probably, we should adjust comment.
PS: And now this really closed.
pythongh-122637: fix tanh(±0+infj) and tanh(±0+nanj) to return ±0+nanj (
pythongh-122637: fix tanh(±0+infj) and tanh(±0+nanj) to return ±0+nanj (