mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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:
parent
936d518dc8
commit
8f9f8d612a
4 changed files with 10 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue