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
0b7d02a3
Kaydet (Commit)
0b7d02a3
authored
Agu 12, 1994
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
New patches by Andrew to fix various problems
üst
e149fa2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
5 deletions
+24
-5
floatobject.c
Objects/floatobject.c
+24
-5
No files found.
Objects/floatobject.c
Dosyayı görüntüle @
0b7d02a3
...
@@ -290,19 +290,31 @@ float_divmod(v, w)
...
@@ -290,19 +290,31 @@ float_divmod(v, w)
}
}
static
object
*
static
object
*
float_pow
(
v
,
w
)
float_pow
(
v
,
w
,
z
)
floatobject
*
v
;
floatobject
*
v
;
floatobject
*
w
;
floatobject
*
w
;
floatobject
*
z
;
{
{
double
iv
,
iw
,
ix
;
double
iv
,
iw
,
ix
;
iv
=
v
->
ob_fval
;
iv
=
v
->
ob_fval
;
iw
=
w
->
ob_fval
;
iw
=
w
->
ob_fval
;
/* XXX Doesn't handle overflows if z!=None yet; it may never do so :(
* The z parameter is really only going to be useful for integers and
* long integers. Maybe something clever with logarithms could be done.
* [AMK]
*/
/* Sort out special cases here instead of relying on pow() */
/* Sort out special cases here instead of relying on pow() */
if
(
iw
==
0
.
0
)
if
(
iw
==
0
.
0
)
{
/* x**0 is 1, even 0**0 */
return
newfloatobject
(
1
.
0
);
/* x**0 is 1, even 0**0 */
if
((
object
*
)
z
!=
None
)
{
ix
=
fmod
(
1
.
0
,
z
->
ob_fval
);
if
(
ix
!=
0
&&
z
->
ob_fval
<
0
)
ix
+=
z
->
ob_fval
;
}
else
ix
=
1
.
0
;
return
newfloatobject
(
ix
);
}
if
(
iv
==
0
.
0
)
{
if
(
iv
==
0
.
0
)
{
if
(
iw
<
0
.
0
)
{
if
(
iw
<
0
.
0
)
{
err_setstr
(
ValueError
,
"0.0 to
the
negative power"
);
err_setstr
(
ValueError
,
"0.0 to
a
negative power"
);
return
NULL
;
return
NULL
;
}
}
return
newfloatobject
(
0
.
0
);
return
newfloatobject
(
0
.
0
);
...
@@ -319,6 +331,13 @@ float_pow(v, w)
...
@@ -319,6 +331,13 @@ float_pow(v, w)
err_errno
(
OverflowError
);
err_errno
(
OverflowError
);
return
NULL
;
return
NULL
;
}
}
if
((
object
*
)
z
!=
None
)
{
ix
=
fmod
(
ix
,
z
->
ob_fval
);
/* XXX To Be Rewritten */
if
(
ix
!=
0
&&
((
iv
<
0
&&
z
->
ob_fval
>
0
)
||
(
iv
>
0
&&
z
->
ob_fval
<
0
)
))
{
ix
+=
z
->
ob_fval
;
}
}
return
newfloatobject
(
ix
);
return
newfloatobject
(
ix
);
}
}
...
@@ -407,7 +426,7 @@ static number_methods float_as_number = {
...
@@ -407,7 +426,7 @@ static number_methods float_as_number = {
(
binaryfunc
)
float_div
,
/*nb_divide*/
(
binaryfunc
)
float_div
,
/*nb_divide*/
(
binaryfunc
)
float_rem
,
/*nb_remainder*/
(
binaryfunc
)
float_rem
,
/*nb_remainder*/
(
binaryfunc
)
float_divmod
,
/*nb_divmod*/
(
binaryfunc
)
float_divmod
,
/*nb_divmod*/
(
bi
naryfunc
)
float_pow
,
/*nb_power*/
(
ter
naryfunc
)
float_pow
,
/*nb_power*/
(
unaryfunc
)
float_neg
,
/*nb_negative*/
(
unaryfunc
)
float_neg
,
/*nb_negative*/
(
unaryfunc
)
float_pos
,
/*nb_positive*/
(
unaryfunc
)
float_pos
,
/*nb_positive*/
(
unaryfunc
)
float_abs
,
/*nb_absolute*/
(
unaryfunc
)
float_abs
,
/*nb_absolute*/
...
...
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