Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
0a891d70
Kaydet (Commit)
0a891d70
authored
Agu 15, 2016
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #12345: Add mathemathcal constant tau to math and cmath.
Patch by Lisa Roach. See also PEP 628.
üst
6349612a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
2 deletions
+23
-2
cmath.rst
Doc/library/cmath.rst
+4
-2
math.rst
Doc/library/math.rst
+7
-0
pymath.h
Include/pymath.h
+6
-0
test_math.py
Lib/test/test_math.py
+1
-0
NEWS
Misc/NEWS
+3
-0
cmathmodule.c
Modules/cmathmodule.c
+1
-0
mathmodule.c
Modules/mathmodule.c
+1
-0
No files found.
Doc/library/cmath.rst
Dosyayı görüntüle @
0a891d70
...
...
@@ -253,6 +253,10 @@ Constants
The mathematical constant *e*, as a float.
.. data:: tau
The mathematical constant *τ*, as a float.
.. index:: module: math
Note that the selection of functions is similar, but not identical, to that in
...
...
@@ -276,5 +280,3 @@ cuts for numerical purposes, a good reference should be the following:
Kahan, W: Branch cuts for complex elementary functions; or, Much ado about
nothing's sign bit. In Iserles, A., and Powell, M. (eds.), The state of the art
in numerical analysis. Clarendon Press (1987) pp165-211.
Doc/library/math.rst
Dosyayı görüntüle @
0a891d70
...
...
@@ -426,6 +426,13 @@ Constants
The mathematical constant e = 2.718281..., to available precision.
.. data:: tau
The mathematical constant τ = 6.283185..., to available precision.
Tau is a circle constant equal to 2π, the ratio of a circle's circumference to
its radius. To learn more about Tau, check out Vi Hart's video `Pi is (still)
Wrong <https://www.youtube.com/watch?v=jG7vhMMXagQ>`_, and start celebrating
`Tau day <http://tauday.com/>`_ by eating twice as much pie!
.. data:: inf
...
...
Include/pymath.h
Dosyayı görüntüle @
0a891d70
...
...
@@ -55,6 +55,12 @@ extern double pow(double, double);
#define Py_MATH_E 2.7182818284590452354
#endif
/* Tau (2pi) to 40 digits, taken from tauday.com/tau-digits. */
#ifndef Py_MATH_TAU
#define Py_MATH_TAU 6.2831853071795864769252867665590057683943L
#endif
/* On x86, Py_FORCE_DOUBLE forces a floating-point number out of an x87 FPU
register and into a 64-bit memory location, rounding from extended
precision to double precision in the process. On other platforms it does
...
...
Lib/test/test_math.py
Dosyayı görüntüle @
0a891d70
...
...
@@ -196,6 +196,7 @@ class MathTests(unittest.TestCase):
def
testConstants
(
self
):
self
.
ftest
(
'pi'
,
math
.
pi
,
3.1415926
)
self
.
ftest
(
'e'
,
math
.
e
,
2.7182818
)
self
.
assertEqual
(
math
.
tau
,
2
*
math
.
pi
)
def
testAcos
(
self
):
self
.
assertRaises
(
TypeError
,
math
.
acos
)
...
...
Misc/NEWS
Dosyayı görüntüle @
0a891d70
...
...
@@ -57,6 +57,9 @@ Core and Builtins
Library
-------
-
Issue
#
12345
:
Add
mathemathcal
constant
tau
to
math
and
cmath
.
See
also
PEP
628.
-
Issue
#
26823
:
traceback
.
StackSummary
.
format
now
abbreviates
large
sections
of
repeated
lines
as
"[Previous line repeated {count} more times]"
(
this
change
then
further
affects
other
traceback
display
operations
in
the
module
).
Patch
...
...
Modules/cmathmodule.c
Dosyayı görüntüle @
0a891d70
...
...
@@ -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 */
...
...
Modules/mathmodule.c
Dosyayı görüntüle @
0a891d70
...
...
@@ -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
()));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment