python / python/cpython

Decide on fate of missing C23 math.h functions

Abierto
#150,646 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

extension-modules type-feature
Lenguaje dominante
Python
Estrellas
77.2k
Forks
35.9k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

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:

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Empieza leyendo el contexto del módulo math de Python y las referencias de C23 enlazadas en la issue; después revisa la issue de continuación #135853 y el debate en #150534. El trabajo aún no está listo para la implementación: se considerará terminado cuando se haya tomado una decisión sobre cuáles de las funciones, cambios de nombres o cambios semánticos enumerados debería adoptar Python.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
c, python
Área
api, backend
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Tranquilo
Claridad
Necesita aclaración
Aptitud para principiantes
28/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.