Commit d5bd0a0
committed
pythongh-133895: correct values of cmath.cosh/sinh in case of overflows
This is a split-off pythongh-134995.
The C17 standard says (cis(y) is defined as cos(y) + i sin(y)):
* ccosh(+∞ + i0) returns +∞ + i0.
* ccosh(+∞ + iy) returns +∞ cis(y), for finite nonzero y.
and
* csinh(+∞ + i0) returns +∞ + i0.
* csinh(+∞ + iy) returns +∞ cis(y), for positive finite y.
So far values, computed for exceptions, aren't accessible from the
pure-Python world, yet we are trying to be correct in other places. The
Lib/test/mathdata/cmath_testcases.txt has data points with correct
numbers (see cosh0032 and sinh0032).
Also, use AC magic for the rect() value.1 parent 5b3a826 commit d5bd0a0
2 files changed
+25
-11
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
441 | 444 | | |
442 | 445 | | |
443 | 446 | | |
| |||
674 | 677 | | |
675 | 678 | | |
676 | 679 | | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
677 | 683 | | |
678 | 684 | | |
679 | 685 | | |
| |||
972 | 978 | | |
973 | 979 | | |
974 | 980 | | |
975 | | - | |
| 981 | + | |
976 | 982 | | |
977 | 983 | | |
978 | 984 | | |
| |||
981 | 987 | | |
982 | 988 | | |
983 | 989 | | |
984 | | - | |
| 990 | + | |
985 | 991 | | |
986 | | - | |
| 992 | + | |
987 | 993 | | |
988 | 994 | | |
989 | 995 | | |
| |||
1027 | 1033 | | |
1028 | 1034 | | |
1029 | 1035 | | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
| 1036 | + | |
1035 | 1037 | | |
1036 | 1038 | | |
1037 | 1039 | | |
| |||
0 commit comments