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
1bdf7e9c
Kaydet (Commit)
1bdf7e9c
authored
Nis 18, 2009
tarafından
Mark Dickinson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #1869: Fix a couple of minor round() issues.
üst
8e5446f9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
test_builtin.py
Lib/test/test_builtin.py
+3
-0
NEWS
Misc/NEWS
+3
-0
bltinmodule.c
Python/bltinmodule.c
+1
-4
No files found.
Lib/test/test_builtin.py
Dosyayı görüntüle @
1bdf7e9c
...
...
@@ -1224,6 +1224,9 @@ class BuiltinTest(unittest.TestCase):
self
.
assertEqual
(
round
(
-
5.5
),
-
6
)
self
.
assertEqual
(
round
(
-
6.5
),
-
7
)
# Issue #1869: integral floats should remain unchanged
self
.
assertEqual
(
round
(
5e15
+
1
),
5e15
+
1
)
# Check behavior on ints
self
.
assertEqual
(
round
(
0
),
0
)
self
.
assertEqual
(
round
(
8
),
8
)
...
...
Misc/NEWS
Dosyayı görüntüle @
1bdf7e9c
...
...
@@ -12,6 +12,9 @@ What's New in Python 2.7 alpha 1
Core and Builtins
-----------------
- Issue #1869: fix a couple of minor round() issues. round(5e15+1)
was giving 5e15+2; round(-0.0) was losing the sign of the zero.
- Issue #5759: float() didn't call __float__ on str subclasses.
- Issue #5704: the "-3" command-line option now implies "-t".
...
...
Python/bltinmodule.c
Dosyayı görüntüle @
1bdf7e9c
...
...
@@ -2081,10 +2081,7 @@ builtin_round(PyObject *self, PyObject *args, PyObject *kwds)
number
/=
f
;
else
number
*=
f
;
if
(
number
>=
0
.
0
)
number
=
floor
(
number
+
0
.
5
);
else
number
=
ceil
(
number
-
0
.
5
);
number
=
round
(
number
);
if
(
ndigits
<
0
)
number
*=
f
;
else
...
...
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