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
99b55482
Kaydet (Commit)
99b55482
authored
Eki 26, 2004
tarafından
Facundo Batista
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Very few little improvements.
üst
cb91900f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
decimal.py
Lib/decimal.py
+8
-10
No files found.
Lib/decimal.py
Dosyayı görüntüle @
99b55482
...
...
@@ -938,15 +938,13 @@ class Decimal(object):
sign
=
1
return
Decimal
(
(
sign
,
(
0
,),
exp
))
if
not
self
:
if
exp
<
other
.
_exp
-
context
.
prec
-
1
:
exp
=
other
.
_exp
-
context
.
prec
-
1
exp
=
max
(
exp
,
other
.
_exp
-
context
.
prec
-
1
)
ans
=
other
.
_rescale
(
exp
,
watchexp
=
0
,
context
=
context
)
if
shouldround
:
ans
=
ans
.
_fix
(
context
)
return
ans
if
not
other
:
if
exp
<
self
.
_exp
-
context
.
prec
-
1
:
exp
=
self
.
_exp
-
context
.
prec
-
1
exp
=
max
(
exp
,
self
.
_exp
-
context
.
prec
-
1
)
ans
=
self
.
_rescale
(
exp
,
watchexp
=
0
,
context
=
context
)
if
shouldround
:
ans
=
ans
.
_fix
(
context
)
...
...
@@ -1228,7 +1226,6 @@ class Decimal(object):
if
divmod
and
res
.
exp
>
context
.
prec
+
1
:
return
context
.
_raise_error
(
DivisionImpossible
)
ans
=
None
prec_limit
=
10
**
context
.
prec
while
1
:
while
op2
.
int
<=
op1
.
int
:
...
...
@@ -1454,24 +1451,25 @@ class Decimal(object):
if
context
is
None
:
context
=
getcontext
()
prec
=
context
.
prec
ans
=
self
.
_fixexponents
(
prec
,
context
)
ans
=
self
.
_fixexponents
(
context
)
if
len
(
ans
.
_int
)
>
prec
:
ans
=
ans
.
_round
(
prec
,
context
=
context
)
ans
=
ans
.
_fixexponents
(
prec
,
context
)
ans
=
ans
.
_fixexponents
(
context
)
return
ans
def
_fixexponents
(
self
,
prec
,
context
):
def
_fixexponents
(
self
,
context
):
"""Fix the exponents and return a copy with the exponent in bounds.
Only call if known to not be a special value.
"""
folddown
=
context
.
_clamp
Emin
=
context
.
Emin
ans
=
Decimal
(
self
)
ans
=
self
ans_adjusted
=
ans
.
adjusted
()
if
ans_adjusted
<
Emin
:
Etiny
=
context
.
Etiny
()
if
ans
.
_exp
<
Etiny
:
if
not
ans
:
ans
=
Decimal
(
self
)
ans
.
_exp
=
Etiny
context
.
_raise_error
(
Clamped
)
return
ans
...
...
@@ -1493,6 +1491,7 @@ class Decimal(object):
Emax
=
context
.
Emax
if
ans_adjusted
>
Emax
:
if
not
ans
:
ans
=
Decimal
(
self
)
ans
.
_exp
=
Emax
context
.
_raise_error
(
Clamped
)
return
ans
...
...
@@ -1508,7 +1507,6 @@ class Decimal(object):
context determines it.
"""
if
self
.
_is_special
:
ans
=
self
.
_check_nans
(
context
=
context
)
if
ans
:
...
...
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