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
f0320c7e
Kaydet (Commit)
f0320c7e
authored
Nis 26, 2009
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove the round() discussion which is now out-of-date.
üst
ce95e564
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
17 deletions
+2
-17
floatingpoint.rst
Doc/tutorial/floatingpoint.rst
+2
-17
No files found.
Doc/tutorial/floatingpoint.rst
Dosyayı görüntüle @
f0320c7e
...
...
@@ -108,23 +108,8 @@ reproduce *x*, but the output may be more pleasant to look at::
It's important to realize that this is, in a real sense, an illusion: you're
simply rounding the *display* of the true machine value.
Other surprises follow from this one. For example, after seeing ::
>>> format(0.1, '.17g')
'0.10000000000000001'
you may be tempted to use the :func:`round` function to chop it back to the
single digit you expect. But that makes no difference::
>>> format(round(0.1, 1), '.17g')
'0.10000000000000001'
The problem is that the binary floating-point value stored for "0.1" was already
the best possible binary approximation to 1/10, so trying to round it again
can't make it better: it was already as good as it gets.
Another consequence is that since 0.1 is not exactly 1/10, summing ten values of
0.1 may not yield exactly 1.0, either::
One illusion may beget another. For example, since 0.1 is not exactly 1/10,
summing ten values of 0.1 may not yield exactly 1.0, either::
>>> sum = 0.0
>>> for i in range(10):
...
...
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