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
d7c71159
Kaydet (Commit)
d7c71159
authored
Tem 12, 2004
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Small elaboration and typo fixes.
üst
5492f3d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
+19
-5
libdecimal.tex
Doc/lib/libdecimal.tex
+19
-5
No files found.
Doc/lib/libdecimal.tex
Dosyayı görüntüle @
d7c71159
...
...
@@ -22,7 +22,7 @@ arithmetic. It offers several advantages over the \class{float()} datatype:
\item
Decimal numbers can be represented exactly. In contrast, numbers like
\constant
{
1.1
}
do not have an exact representation in binary floating point.
End users typically wou
n
d not expect
\constant
{
1.1
}
to display as
End users typically wou
l
d not expect
\constant
{
1.1
}
to display as
\constant
{
1.1000000000000001
}
as it does with binary floating point.
\item
The exactness carries over into arithmetic. In decimal floating point,
...
...
@@ -538,7 +538,19 @@ large number of methods for doing arithmetic directly in a given context.
rounding method, flags, and traps are applied to the conversion.
This is useful because constants are often given to a greater precision than
is needed by the application.
is needed by the application. Another benefit is that rounding immediately
eliminates unintended effects from digits beyond the current precision.
In the following example, using unrounded inputs means that adding zero
to a sum can change the result:
\begin{verbatim}
>>> getcontext().prec = 3
>>> Decimal("3.4445") + Decimal("1.0023")
Decimal("4.45")
>>> Decimal("3.4445") + Decimal(0) + Decimal("1.0023")
Decimal("4.44")
\end{verbatim}
\end{methoddesc}
\begin{methoddesc}
{
Etiny
}{}
...
...
@@ -612,12 +624,14 @@ here.
\begin{methoddesc}
{
normalize
}{
x
}
Normalize reduces an operand to its simplest form.
Essentially a
plus operation with all trailing zeros removed from the
result.
Essentially a
\method
{
plus
}
operation with all trailing zeros removed from
the
result.
\end{methoddesc}
\begin{methoddesc}
{
plus
}{
x
}
Minus corresponds to the unary prefix plus operator in Python.
Plus corresponds to the unary prefix plus operator in Python. This
operation applies the context precision and rounding, so it is
\emph
{
not
}
an identity operation.
\end{methoddesc}
\begin{methoddesc}
{
power
}{
x, y
\optional
{
, modulo
}}
...
...
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