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
70aa1f20
Kaydet (Commit)
70aa1f20
authored
Agu 22, 2004
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix repr for negative imaginary part. Fixes #1013908.
üst
f82a9ded
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
test_complex.py
Lib/test/test_complex.py
+1
-0
complexobject.c
Objects/complexobject.c
+6
-2
No files found.
Lib/test/test_complex.py
Dosyayı görüntüle @
70aa1f20
...
@@ -286,6 +286,7 @@ class ComplexTest(unittest.TestCase):
...
@@ -286,6 +286,7 @@ class ComplexTest(unittest.TestCase):
def
test_repr
(
self
):
def
test_repr
(
self
):
self
.
assertEqual
(
repr
(
1
+
6
j
),
'(1+6j)'
)
self
.
assertEqual
(
repr
(
1
+
6
j
),
'(1+6j)'
)
self
.
assertEqual
(
repr
(
1
-
6
j
),
'(1-6j)'
)
def
test_neg
(
self
):
def
test_neg
(
self
):
self
.
assertEqual
(
-
(
1
+
6
j
),
-
1
-
6
j
)
self
.
assertEqual
(
-
(
1
+
6
j
),
-
1
-
6
j
)
...
...
Objects/complexobject.c
Dosyayı görüntüle @
70aa1f20
...
@@ -279,11 +279,15 @@ complex_to_buf(char *buf, int bufsz, PyComplexObject *v, int precision)
...
@@ -279,11 +279,15 @@ complex_to_buf(char *buf, int bufsz, PyComplexObject *v, int precision)
strncat
(
buf
,
"j"
,
bufsz
);
strncat
(
buf
,
"j"
,
bufsz
);
}
else
{
}
else
{
char
re
[
64
],
im
[
64
];
char
re
[
64
],
im
[
64
];
char
*
fmt
;
PyOS_snprintf
(
format
,
32
,
"%%.%ig"
,
precision
);
PyOS_snprintf
(
format
,
32
,
"%%.%ig"
,
precision
);
PyOS_ascii_formatd
(
re
,
64
,
format
,
v
->
cval
.
real
);
PyOS_ascii_formatd
(
re
,
64
,
format
,
v
->
cval
.
real
);
PyOS_ascii_formatd
(
im
,
64
,
format
,
v
->
cval
.
imag
);
PyOS_ascii_formatd
(
im
,
64
,
format
,
v
->
cval
.
imag
);
PyOS_snprintf
(
buf
,
bufsz
,
"(%s+%sj)"
,
re
,
im
);
if
(
v
->
cval
.
imag
<
0
.)
fmt
=
"(%s%sj)"
;
else
fmt
=
"(%s+%sj)"
;
PyOS_snprintf
(
buf
,
bufsz
,
fmt
,
re
,
im
);
}
}
}
}
...
...
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