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
a123631a
Kaydet (Commit)
a123631a
authored
Tem 08, 2010
tarafından
Mark Dickinson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix a performance issue in Decimal.pow. Thanks Stefan Krah for finding this.
üst
f48ea7c2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
6 deletions
+25
-6
decimal.py
Lib/decimal.py
+8
-6
extra.decTest
Lib/test/decimaltestdata/extra.decTest
+13
-0
NEWS
Misc/NEWS
+4
-0
No files found.
Lib/decimal.py
Dosyayı görüntüle @
a123631a
...
...
@@ -2047,12 +2047,14 @@ class Decimal(object):
# case where xc == 1: result is 10**(xe*y), with xe*y
# required to be an integer
if
xc
==
1
:
if
ye
>=
0
:
exponent
=
xe
*
yc
*
10
**
ye
else
:
exponent
,
remainder
=
divmod
(
xe
*
yc
,
10
**-
ye
)
if
remainder
:
return
None
xe
*=
yc
# result is now 10**(xe * 10**ye); xe * 10**ye must be integral
while
xe
%
10
==
0
:
xe
//=
10
ye
+=
1
if
ye
<
0
:
return
None
exponent
=
xe
*
10
**
ye
if
y
.
sign
==
1
:
exponent
=
-
exponent
# if other is a nonnegative integer, use ideal exponent
...
...
Lib/test/decimaltestdata/extra.decTest
Dosyayı görüntüle @
a123631a
...
...
@@ -213,7 +213,20 @@ extr1658 shift 1234567 3 -> 7000
extr1659 shift 1234567 4 -> 0
extr1660 shift 1234567 5 -> NaN Invalid_operation
-- Cases where the power function was impossibly slow to determine that the
-- result is inexact. Thanks Stefan Krah for identifying this problem.
precision: 16
maxExponent: 999999999
minExponent: -999999999
extr1700 power 10 1e-999999999 -> 1.000000000000000 Inexact Rounded
extr1701 power 100.0 -557.71e-742888888 -> 1.000000000000000 Inexact Rounded
extr1702 power 10 1e-100 -> 1.000000000000000 Inexact Rounded
-- A couple of interesting exact cases for power. Note that the specification
-- requires these to be reported as Inexact.
extr1710 power 1e375 56e-3 -> 1.000000000000000E+21 Inexact Rounded
extr1711 power 10000 0.75 -> 1000.000000000000 Inexact Rounded
extr1712 power 1e-24 0.875 -> 1.000000000000000E-21 Inexact Rounded
-- Tests for the is_* boolean operations
precision: 9
...
...
Misc/NEWS
Dosyayı görüntüle @
a123631a
...
...
@@ -470,6 +470,10 @@ C-API
Library
-------
- Fix extreme speed issue in Decimal.pow when the base is an exact
power of 10 and the exponent is tiny (for example,
Decimal(10) ** Decimal('1e-999999999')).
- Issue #9186: Fix math.log1p(-1.0) to raise ValueError, not OverflowError.
- Issue #9130: Fix validation of relative imports in parser module.
...
...
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