Skip to content

Commit b21ba08

Browse files
committed
pythongh-101594: Resolve a disambiguation of math.e vs the Euler's number
1 parent 6aab56f commit b21ba08

6 files changed

Lines changed: 20 additions & 27 deletions

File tree

‎Doc/library/cmath.rst‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ Power and logarithmic functions
8585

8686
.. function:: exp(x)
8787

88-
Return *e* raised to the power *x*, where *e* is the base of natural
89-
logarithms.
88+
Return the exponential function at *x*.
9089

9190

9291
.. function:: log(x[, base])

‎Doc/library/math.rst‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,8 @@ Power and logarithmic functions
364364

365365
.. function:: exp(x)
366366

367-
Return *e* raised to the power *x*, where *e* = 2.718281... is the base
368-
of natural logarithms. This is usually more accurate than ``math.e ** x``
369-
or ``pow(math.e, x)``.
367+
Return the exponential function at *x*. This is usually more accurate
368+
than ``math.e ** x``.
370369

371370

372371
.. function:: exp2(x)
@@ -378,9 +377,8 @@ Power and logarithmic functions
378377

379378
.. function:: expm1(x)
380379

381-
Return *e* raised to the power *x*, minus 1. Here *e* is the base of natural
382-
logarithms. For small floats *x*, the subtraction in ``exp(x) - 1``
383-
can result in a `significant loss of precision
380+
Return ``exp(x) - 1``. For small floats *x*, the direct subtraction
381+
in ``exp(x) - 1`` can result in a `significant loss of precision
384382
<https://en.wikipedia.org/wiki/Loss_of_significance>`_\; the :func:`expm1`
385383
function provides a way to compute this quantity to full precision:
386384

@@ -395,15 +393,15 @@ Power and logarithmic functions
395393

396394
.. function:: log(x[, base])
397395

398-
With one argument, return the natural logarithm of *x* (to base *e*).
396+
With one argument, return the natural logarithm of *x*.
399397

400398
With two arguments, return the logarithm of *x* to the given *base*,
401399
calculated as ``log(x)/log(base)``.
402400

403401

404402
.. function:: log1p(x)
405403

406-
Return the natural logarithm of *1+x* (base *e*). The
404+
Return the natural logarithm of *1+x*. The
407405
result is calculated in a way which is accurate for *x* near zero.
408406

409407

‎Modules/clinic/cmathmodule.c.h‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Modules/clinic/mathmodule.c.h‎

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Modules/cmathmodule.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -546,12 +546,12 @@ static Py_complex exp_special_values[7][7];
546546
/*[clinic input]
547547
cmath.exp = cmath.acos
548548
549-
Return the exponential value e**z.
549+
Return the exponential function at z.
550550
[clinic start generated code]*/
551551

552552
static Py_complex
553553
cmath_exp_impl(PyObject *module, Py_complex z)
554-
/*[clinic end generated code: output=edcec61fb9dfda6c input=8b9e6cf8a92174c3]*/
554+
/*[clinic end generated code: output=edcec61fb9dfda6c input=87f2c74ee9a8ad46]*/
555555
{
556556
Py_complex r;
557557
double l;
@@ -957,12 +957,12 @@ cmath.log
957957
958958
log(z[, base]) -> the logarithm of z to the given base.
959959
960-
If the base not specified, returns the natural logarithm (base e) of z.
960+
If the base not specified, returns the natural logarithm of z.
961961
[clinic start generated code]*/
962962

963963
static PyObject *
964964
cmath_log_impl(PyObject *module, Py_complex x, PyObject *y_obj)
965-
/*[clinic end generated code: output=4effdb7d258e0d94 input=230ed3a71ecd000a]*/
965+
/*[clinic end generated code: output=4effdb7d258e0d94 input=55c7d74ab7072229]*/
966966
{
967967
Py_complex y;
968968

‎Modules/mathmodule.c‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ FUNC1A(erfc, erfc,
10841084
"Complementary error function at x.")
10851085
FUNC1(exp, exp, 1,
10861086
"exp($module, x, /)\n--\n\n"
1087-
"Return e raised to the power of x.")
1087+
"Return the exponential function at x.")
10881088
FUNC1(exp2, exp2, 1,
10891089
"exp2($module, x, /)\n--\n\n"
10901090
"Return 2 raised to the power of x.")
@@ -1143,7 +1143,7 @@ FUNC1A(lgamma, m_lgamma,
11431143
"Natural logarithm of absolute value of Gamma function at x.")
11441144
FUNC1(log1p, m_log1p, 0,
11451145
"log1p($module, x, /)\n--\n\n"
1146-
"Return the natural logarithm of 1+x (base e).\n\n"
1146+
"Return the natural logarithm of 1+x.\n\n"
11471147
"The result is computed in a way which is accurate for x near zero.")
11481148
FUNC2(remainder, m_remainder,
11491149
"remainder($module, x, y, /)\n--\n\n"
@@ -2186,15 +2186,13 @@ math.log
21862186
]
21872187
/
21882188
2189-
Return the logarithm of x to the given base.
2190-
2191-
If the base not specified, returns the natural logarithm (base e) of x.
2189+
Return the logarithm of x to the given base or the natural logarithm of x.
21922190
[clinic start generated code]*/
21932191

21942192
static PyObject *
21952193
math_log_impl(PyObject *module, PyObject *x, int group_right_1,
21962194
PyObject *base)
2197-
/*[clinic end generated code: output=7b5a39e526b73fc9 input=0f62d5726cbfebbd]*/
2195+
/*[clinic end generated code: output=7b5a39e526b73fc9 input=e74bd6b80f8d66fd]*/
21982196
{
21992197
PyObject *num, *den;
22002198
PyObject *ans;

0 commit comments

Comments
 (0)