Decide on fate of missing C23 math.h functions
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先阅读 Python math 模块的上下文以及 issue 中链接的 C23 参考资料,然后查看后续 issue #135853 和 #150534 中的讨论。目前这项工作还未达到可以实现的程度:完成的标准是就 Python 应采用所列出的哪些函数、命名变更或语义变更作出决定。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, python
- 领域
- api, backend
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 冷清
- 描述清晰度
- 需要澄清
- 新手友好度
- 28/100