Skip to content

Commit 31a27c1

Browse files
committed
add math.exp2 to python's math library
1 parent aaf4222 commit 31a27c1

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added :func:`math.exp2`:, which returns 2 raised to the power of x.

Modules/mathmodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,9 @@ FUNC1A(erfc, m_erfc,
12481248
FUNC1(exp, exp, 1,
12491249
"exp($module, x, /)\n--\n\n"
12501250
"Return e raised to the power of x.")
1251+
FUNC1(exp2, exp2, 1,
1252+
"exp2($module, x, /)\n--\n\n"
1253+
"Return 2 raised to the power of x.")
12511254
FUNC1(expm1, expm1, 1,
12521255
"expm1($module, x, /)\n--\n\n"
12531256
"Return exp(x)-1.\n\n"
@@ -3564,6 +3567,7 @@ static PyMethodDef math_methods[] = {
35643567
{"erf", math_erf, METH_O, math_erf_doc},
35653568
{"erfc", math_erfc, METH_O, math_erfc_doc},
35663569
{"exp", math_exp, METH_O, math_exp_doc},
3570+
{"exp2", math_exp2, METH_O, math_exp2_doc},
35673571
{"expm1", math_expm1, METH_O, math_expm1_doc},
35683572
{"fabs", math_fabs, METH_O, math_fabs_doc},
35693573
MATH_FACTORIAL_METHODDEF

0 commit comments

Comments
 (0)