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
eafaf4c0
Kaydet (Commit)
eafaf4c0
authored
Haz 28, 2009
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Small doc fix-ups to floatingpoint.rst. More are forthcoming.
üst
97479ad6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
floatingpoint.rst
Doc/tutorial/floatingpoint.rst
+5
-5
No files found.
Doc/tutorial/floatingpoint.rst
Dosyayı görüntüle @
eafaf4c0
...
...
@@ -82,7 +82,7 @@ values share the same approximation, any one of them could be displayed
while still preserving the invariant ``eval(repr(x)) == x``.
Historically, the Python prompt and built-in :func:`repr` function would chose
the one with 17 significant digits, ``0.10000000000000001``
,
Starting with
the one with 17 significant digits, ``0.10000000000000001``
.
Starting with
Python 3.1, Python (on most systems) is now able to choose the shortest of
these and simply display ``0.1``.
...
...
@@ -123,9 +123,9 @@ Also, since the 0.1 cannot get any closer to the exact value of 1/10 and
Though the numbers cannot be made closer to their intended exact values,
the :func:`round` function can be useful for post-rounding so that results
have inexact values that ar
e comparable to one another::
with inexact values becom
e comparable to one another::
>>> round(.1 + .1 + .1, 1
) == round(.3, 1
)
>>> round(.1 + .1 + .1, 1
0) == round(.3, 10
)
True
Binary floating-point arithmetic holds many surprises like this. The problem
...
...
@@ -137,7 +137,7 @@ As that says near the end, "there are no easy answers." Still, don't be unduly
wary of floating-point! The errors in Python float operations are inherited
from the floating-point hardware, and on most machines are on the order of no
more than 1 part in 2\*\*53 per operation. That's more than adequate for most
tasks, but you do need to keep in mind that it's not decimal arithmetic
,
and
tasks, but you do need to keep in mind that it's not decimal arithmetic and
that every float operation can suffer a new rounding error.
While pathological cases do exist, for most casual use of floating-point
...
...
@@ -165,7 +165,7 @@ fraction::
>>> x = 3.14159
>>> x.as_integer_ratio()
(3537115888337719
L, 1125899906842624L
)
(3537115888337719
, 1125899906842624
)
Since the ratio is exact, it can be used to losslessly recreate the
original value::
...
...
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