https://github.com/python/cpython/commit/3462a80d2cf37a63fe43f46f64a8c9823f84531d
commit: 3462a80d2cf37a63fe43f46f64a8c9823f84531d
branch: main
author: Sergey B Kirpichev <[email protected]>
committer: mdickinson <[email protected]>
date: 2024-08-04T09:53:17+01:00
summary:
gh-121889: cmath.acosh(0+nanj) returns nan+pi/2j (#121892)
As per C11 DR#471 (adjusted resolution accepted for C17), cacosh (0 +
iNaN) should return NaN ± i pi/2, not NaN + iNaN. This patch
fixes cmath's code to do same.
files:
A Misc/NEWS.d/next/Library/2024-07-17-09-23-03.gh-issue-121889.6se9jS.rst
M Lib/test/mathdata/cmath_testcases.txt
M Modules/cmathmodule.c
diff --git a/Lib/test/mathdata/cmath_testcases.txt
b/Lib/test/mathdata/cmath_testcases.txt
index 0165e17634f41c..0c0d2d703f07f8 100644
--- a/Lib/test/mathdata/cmath_testcases.txt
+++ b/Lib/test/mathdata/cmath_testcases.txt
@@ -371,9 +371,9 @@ acosh1002 acosh 0.0 inf -> inf 1.5707963267948966
acosh1003 acosh 2.3 inf -> inf 1.5707963267948966
acosh1004 acosh -0.0 inf -> inf 1.5707963267948966
acosh1005 acosh -2.3 inf -> inf 1.5707963267948966
-acosh1006 acosh 0.0 nan -> nan nan
+acosh1006 acosh 0.0 nan -> nan 1.5707963267948966 ignore-imag-sign
acosh1007 acosh 2.3 nan -> nan nan
-acosh1008 acosh -0.0 nan -> nan nan
+acosh1008 acosh -0.0 nan -> nan 1.5707963267948966 ignore-imag-sign
acosh1009 acosh -2.3 nan -> nan nan
acosh1010 acosh -inf 0.0 -> inf 3.1415926535897931
acosh1011 acosh -inf 2.3 -> inf 3.1415926535897931
diff --git
a/Misc/NEWS.d/next/Library/2024-07-17-09-23-03.gh-issue-121889.6se9jS.rst
b/Misc/NEWS.d/next/Library/2024-07-17-09-23-03.gh-issue-121889.6se9jS.rst
new file mode 100644
index 00000000000000..a7babe0580b3e4
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-07-17-09-23-03.gh-issue-121889.6se9jS.rst
@@ -0,0 +1 @@
+Adjusts ``cmath.acosh(complex('0+nanj'))`` for recent C standards.
diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c
index bf86a211bcb188..16ac663bdb9949 100644
--- a/Modules/cmathmodule.c
+++ b/Modules/cmathmodule.c
@@ -1259,8 +1259,8 @@ cmath_exec(PyObject *mod)
INIT_SPECIAL_VALUES(acosh_special_values, {
C(INF,-P34) C(INF,-P) C(INF,-P) C(INF,P) C(INF,P) C(INF,P34) C(INF,N)
C(INF,-P12) C(U,U) C(U,U) C(U,U) C(U,U) C(INF,P12) C(N,N)
- C(INF,-P12) C(U,U) C(0.,-P12) C(0.,P12) C(U,U) C(INF,P12) C(N,N)
- C(INF,-P12) C(U,U) C(0.,-P12) C(0.,P12) C(U,U) C(INF,P12) C(N,N)
+ C(INF,-P12) C(U,U) C(0.,-P12) C(0.,P12) C(U,U) C(INF,P12) C(N,P12)
+ C(INF,-P12) C(U,U) C(0.,-P12) C(0.,P12) C(U,U) C(INF,P12) C(N,P12)
C(INF,-P12) C(U,U) C(U,U) C(U,U) C(U,U) C(INF,P12) C(N,N)
C(INF,-P14) C(INF,-0.) C(INF,-0.) C(INF,0.) C(INF,0.) C(INF,P14) C(INF,N)
C(INF,N) C(N,N) C(N,N) C(N,N) C(N,N) C(INF,N) C(N,N)
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]