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
10959b1c
Kaydet (Commit)
10959b1c
authored
Tem 05, 2004
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Expand examples to show polymorphism
üst
77e13b4e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
libdecimal.tex
Doc/lib/libdecimal.tex
+14
-2
No files found.
Doc/lib/libdecimal.tex
Dosyayı görüntüle @
10959b1c
...
...
@@ -935,7 +935,7 @@ def pi():
3.141592653589793238462643383279502887
"""
getcontext().prec += 9 # extra digits for intermediate steps
three = Decimal(3)
# substitute "three=3.0" for regular floats
three = Decimal(3) # substitute "three=3.0" for regular floats
lastc, t, c, n, na, d, da = 0, three, 3, 1, 0, 0, 24
while c != lastc:
lastc = c
...
...
@@ -947,12 +947,16 @@ def pi():
return c
def exp(x):
"""Return e raised to the power of x.
"""Return e raised to the power of x.
Result type matches input type.
>>> print exp(Decimal(1))
2.718281828459045235360287471352662498
>>> print exp(Decimal(2))
7.389056098930650227230427460575007813
>>> print exp(2.0)
7.38905609893
>>> print exp(2+0j)
(7.38905609893+0j)
"""
getcontext().prec += 9 # extra digits for intermediate steps
i, laste, e, fact, num = 0, 0, 1, 1, 1
...
...
@@ -970,6 +974,10 @@ def cos(x):
>>> print cos(Decimal('0.5'))
0.8775825618903727161162815826038296521
>>> print cos(0.5)
0.87758256189
>>> print cos(0.5+0j)
(0.87758256189+0j)
"""
getcontext().prec += 9 # extra digits for intermediate steps
i, laste, e, fact, num, sign = 0, 0, 1, 1, 1, 1
...
...
@@ -988,6 +996,10 @@ def sin(x):
>>> print sin(Decimal('0.5'))
0.4794255386042030002732879352155713880
>>> print sin(0.5)
0.479425538604
>>> print sin(0.5+0j)
(0.479425538604+0j)
"""
getcontext().prec += 9 # extra digits for intermediate steps
i, laste, e, fact, num, sign = 1, 0, x, 1, x, 1
...
...
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