Decide on fate of missing C23 math.h functions
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 35.9k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
Feature or enhancement
Proposal:
With https://github.com/python/cpython/issues/150534 it seems that sinpi et all will be landed in the math module. Lets discuss here remaining functions, coming with C23:
- exp10 - The exp10 functions compute the base-10 exponential of x.
- exp2m1 - The exp2m1 functions compute the base-2 exponential of the argument, minus 1.
- exp10m1 - The exp10m1 functions compute the base-10 exponential of the argument, minus 1.
- log2p1 - The log2p1 functions compute the base-2 logarithm of 1 plus the argument.
- log10p1 - The log10p1 functions compute the base-10 logarithm of 1 plus the argument.
- logp1 - alias of log1p, should we consider renaming?
- rootn - The rootn functions compute the principal nth root of x.
- rsqrt - The rsqrt functions compute the reciprocal of the nonnegative square root of the argument.
For completeness, cases that can change semantics of pow():
- pown - The pown functions compute x raised to the nth power.
- powr - The powr functions compute x raised to the power y as
e**(y*log(x)).
References:
- n1946.pdf
- C23 standard
CC @picnixz, @rhettinger, @tim-one
I think that missing exp/log functions are good addition on same ground, as existing functions. log1p can be soft-deprecated (I don't think it worth considering deviations in naming like log1p2 and log1p10). I'm less certain about rootn (seems useful, but I would prefer rather some cmath function, that can return any k-th from n roots) and rsqrt.
Consider this as a continuation of https://github.com/python/cpython/issues/135853.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách đọc ngữ cảnh của module math trong Python và các tài liệu tham chiếu C23 được liên kết trong issue, sau đó xem lại issue tiếp nối #135853 và phần thảo luận trong #150534. Công việc vẫn chưa sẵn sàng để triển khai: được xem là hoàn tất khi đạt được quyết định về những function, thay đổi tên hoặc thay đổi ngữ nghĩa nào trong danh sách mà Python nên áp dụng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- c, python
- Lĩnh vực
- api, backend
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 28/100