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
9c91eb84
Kaydet (Commit)
9c91eb84
authored
Tem 07, 2010
tarafından
Mark Dickinson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Minor refactoring in lgamma code, for clarity.
üst
7e4a6ebd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
14 deletions
+10
-14
mathmodule.c
Modules/mathmodule.c
+10
-14
No files found.
Modules/mathmodule.c
Dosyayı görüntüle @
9c91eb84
...
...
@@ -69,6 +69,7 @@ extern double copysign(double, double);
static
const
double
pi
=
3
.
141592653589793238462643383279502884197
;
static
const
double
sqrtpi
=
1
.
772453850905516027298167483341145182798
;
static
const
double
logpi
=
1
.
144729885849400174143427351353058711647
;
static
double
sinpi
(
double
x
)
...
...
@@ -356,20 +357,15 @@ m_lgamma(double x)
if
(
absx
<
1e-20
)
return
-
log
(
absx
);
/* Lanczos' formula */
if
(
x
>
0
.
0
)
{
/* we could save a fraction of a ulp in accuracy by having a
second set of numerator coefficients for lanczos_sum that
absorbed the exp(-lanczos_g) term, and throwing out the
lanczos_g subtraction below; it's probably not worth it. */
r
=
log
(
lanczos_sum
(
x
))
-
lanczos_g
+
(
x
-
0
.
5
)
*
(
log
(
x
+
lanczos_g
-
0
.
5
)
-
1
);
}
else
{
r
=
log
(
pi
)
-
log
(
fabs
(
sinpi
(
absx
)))
-
log
(
absx
)
-
(
log
(
lanczos_sum
(
absx
))
-
lanczos_g
+
(
absx
-
0
.
5
)
*
(
log
(
absx
+
lanczos_g
-
0
.
5
)
-
1
));
}
/* Lanczos' formula. We could save a fraction of a ulp in accuracy by
having a second set of numerator coefficients for lanczos_sum that
absorbed the exp(-lanczos_g) term, and throwing out the lanczos_g
subtraction below; it's probably not worth it. */
r
=
log
(
lanczos_sum
(
absx
))
-
lanczos_g
;
r
+=
(
absx
-
0
.
5
)
*
(
log
(
absx
+
lanczos_g
-
0
.
5
)
-
1
);
if
(
x
<
0
.
0
)
/* Use reflection formula to get value for negative x. */
r
=
logpi
-
log
(
fabs
(
sinpi
(
absx
)))
-
log
(
absx
)
-
r
;
if
(
Py_IS_INFINITY
(
r
))
errno
=
ERANGE
;
return
r
;
...
...
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