Issue #11888: Use system log2() when available

I expect the system libc to use more accurate functions than Python. The GNU
libc uses for example FYL2X and FYL2XP1 hardware instructions on Intel FPU.
This commit is contained in:
Victor Stinner 2011-05-09 12:45:41 +02:00
parent 936d518dc8
commit 8f9f8d612a
4 changed files with 10 additions and 3 deletions

View file

@ -602,6 +602,9 @@ m_log2(double x)
}
if (x > 0.0) {
#ifdef HAVE_LOG2
return log2(x);
#else
double m;
int e;
m = frexp(x, &e);
@ -617,6 +620,7 @@ m_log2(double x)
else {
return log(m) / log(2.0) + e;
}
#endif
}
else if (x == 0.0) {
errno = EDOM;