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
1ea7c756
Kaydet (Commit)
1ea7c756
authored
May 06, 1999
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Reflect recent patch for float % and divmod() by Tim Peters. Content
updates by Tim Peters, markup by FLD.
üst
9263e78f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
libfuncs.tex
Doc/lib/libfuncs.tex
+6
-2
ref5.tex
Doc/ref/ref5.tex
+10
-3
No files found.
Doc/lib/libfuncs.tex
Dosyayı görüntüle @
1ea7c756
...
...
@@ -178,8 +178,12 @@ class instances are callable if they have a \method{__call__()} method.
operand types, the rules for binary arithmetic operators apply. For
plain and long integers, the result is the same as
\code
{
(
\var
{
a
}
/
\var
{
b
}
,
\var
{
a
}
\%
{}
\var
{
b
}
)
}
.
For floating point numbers the result is the same as
\code
{
(math.floor(
\var
{
a
}
/
\var
{
b
}
),
\var
{
a
}
\%
{}
\var
{
b
}
)
}
.
For floating point numbers the result is
\code
{
(
\var
{
q
}
,
\var
{
a
}
\%
{}
\var
{
b
}
)
}
, where
\var
{
q
}
is usually
\code
{
math.floor(
\var
{
a
}
/
\var
{
b
}
)
}
but may be 1 less than that. In any case
\code
{
\var
{
q
}
*
\var
{
b
}
+
\var
{
a
}
\%
{}
\var
{
b
}}
is very close to
\var
{
a
}
, if
\code
{
\var
{
a
}
\%
{}
\var
{
b
}}
is non-zero it has the same sign as
\var
{
b
}
, and
\code
{
0 <= abs(
\var
{
a
}
\%
{}
\var
{
b
}
) < abs(
\var
{
b
}
)
}
.
\end{funcdesc}
\begin{funcdesc}
{
eval
}{
expression
\optional
{
, globals
\optional
{
, locals
}}}
...
...
Doc/ref/ref5.tex
Dosyayı görüntüle @
1ea7c756
...
...
@@ -583,9 +583,16 @@ The integer division and modulo operators are connected by the
following identity:
\code
{
x == (x/y)*y + (x
\%
y)
}
. Integer division and
modulo are also connected with the built-in function
\function
{
divmod()
}
:
\code
{
divmod(x, y) == (x/y, x
\%
y)
}
. These identities don't hold for
floating point and complex numbers; there a similar identity holds where
\code
{
x/y
}
is replaced by
\code
{
floor(x/y)
}
) or
\code
{
floor((x/y).real)
}
, respectively.
floating point and complex numbers; there similar identities hold
approximately where
\code
{
x/y
}
is replaced by
\code
{
floor(x/y)
}
) or
\code
{
floor(x/y) - 1
}
(for floats),
\footnote
{
If x is very close to an exact integer multiple of y, it's
possible for
\code
{
floor(x/y)
}
to be one larger than
\code
{
(x-x
\%
y)/y
}
due to rounding. In such cases, Python returns
the latter result, in order to preserve that
\code
{
divmod(x,y)[0]
* y + x
\%
{}
y
}
be very close to
\code
{
x
}
.
}
or
\code
{
floor((x/y).real)
}
(for
complex).
The
\code
{
+
}
(addition) operator yields the sum of its arguments.
The arguments must either both be numbers or both sequences of the
...
...
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