summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGuido van Rossum <guido@dropbox.com>2016-08-15 16:12:52 (GMT)
committerGuido van Rossum <guido@dropbox.com>2016-08-15 16:12:52 (GMT)
commit0a891d70ded5fa8b1e6491529a3b531f521b5ae1 (patch)
treee26a1c826888bbd3c40b7775406062ab1b32cca5 /Modules
parent6349612a8e5d5fcb3405e59242b6a2df3127585a (diff)
downloadcpython-0a891d70ded5fa8b1e6491529a3b531f521b5ae1.zip
cpython-0a891d70ded5fa8b1e6491529a3b531f521b5ae1.tar.gz
cpython-0a891d70ded5fa8b1e6491529a3b531f521b5ae1.tar.bz2
Issue #12345: Add mathemathcal constant tau to math and cmath.
Patch by Lisa Roach. See also PEP 628.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/cmathmodule.c1
-rw-r--r--Modules/mathmodule.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c
index cba42a7..0e7d4db 100644
--- a/Modules/cmathmodule.c
+++ b/Modules/cmathmodule.c
@@ -1239,6 +1239,7 @@ PyInit_cmath(void)
PyModule_AddObject(m, "pi",
PyFloat_FromDouble(Py_MATH_PI));
PyModule_AddObject(m, "e", PyFloat_FromDouble(Py_MATH_E));
+ PyModule_AddObject(m, "tau", PyFloat_FromDouble(Py_MATH_TAU)); /* 2pi */
/* initialize special value tables */
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index cf04901..43aa229 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -2144,6 +2144,7 @@ PyInit_math(void)
PyModule_AddObject(m, "pi", PyFloat_FromDouble(Py_MATH_PI));
PyModule_AddObject(m, "e", PyFloat_FromDouble(Py_MATH_E));
+ PyModule_AddObject(m, "tau", PyFloat_FromDouble(Py_MATH_TAU)); /* 2pi */
PyModule_AddObject(m, "inf", PyFloat_FromDouble(m_inf()));
#if !defined(PY_NO_SHORT_FLOAT_REPR) || defined(Py_NAN)
PyModule_AddObject(m, "nan", PyFloat_FromDouble(m_nan()));