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
e52c3145
Kaydet (Commit)
e52c3145
authored
Ock 25, 2009
tarafından
Mark Dickinson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove uses of cmp from the decimal module.
üst
b5a4b0ab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
decimal.py
Lib/decimal.py
+15
-3
No files found.
Lib/decimal.py
Dosyayı görüntüle @
e52c3145
...
@@ -801,9 +801,16 @@ class Decimal(object):
...
@@ -801,9 +801,16 @@ class Decimal(object):
if self > other. This routine is for internal use only."""
if self > other. This routine is for internal use only."""
if
self
.
_is_special
or
other
.
_is_special
:
if
self
.
_is_special
or
other
.
_is_special
:
return
cmp
(
self
.
_isinfinity
(),
other
.
_isinfinity
())
self_inf
=
self
.
_isinfinity
()
other_inf
=
other
.
_isinfinity
()
if
self_inf
==
other_inf
:
return
0
elif
self_inf
<
other_inf
:
return
-
1
else
:
return
1
# check for zeros;
note that cmp(0, -0) should return 0
# check for zeros;
Decimal('0') == Decimal('-0')
if
not
self
:
if
not
self
:
if
not
other
:
if
not
other
:
return
0
return
0
...
@@ -823,7 +830,12 @@ class Decimal(object):
...
@@ -823,7 +830,12 @@ class Decimal(object):
if
self_adjusted
==
other_adjusted
:
if
self_adjusted
==
other_adjusted
:
self_padded
=
self
.
_int
+
'0'
*
(
self
.
_exp
-
other
.
_exp
)
self_padded
=
self
.
_int
+
'0'
*
(
self
.
_exp
-
other
.
_exp
)
other_padded
=
other
.
_int
+
'0'
*
(
other
.
_exp
-
self
.
_exp
)
other_padded
=
other
.
_int
+
'0'
*
(
other
.
_exp
-
self
.
_exp
)
return
cmp
(
self_padded
,
other_padded
)
*
(
-
1
)
**
self
.
_sign
if
self_padded
==
other_padded
:
return
0
elif
self_padded
<
other_padded
:
return
-
(
-
1
)
**
self
.
_sign
else
:
return
(
-
1
)
**
self
.
_sign
elif
self_adjusted
>
other_adjusted
:
elif
self_adjusted
>
other_adjusted
:
return
(
-
1
)
**
self
.
_sign
return
(
-
1
)
**
self
.
_sign
else
:
# self_adjusted < other_adjusted
else
:
# self_adjusted < other_adjusted
...
...
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