diff Modules/mathmodule.c @ 69975:565f43f6bed4

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.
author Victor Stinner <victor.stinner@haypocalc.com>
date Mon, 09 May 2011 12:45:41 +0200
parents 627780933948
children 7482d0e3476a
line wrap: on
line diff
--- a/Modules/mathmodule.c	Mon May 09 12:24:09 2011 +0200
+++ b/Modules/mathmodule.c	Mon May 09 12:45:41 2011 +0200
@@ -602,6 +602,9 @@
     }
 
     if (x > 0.0) {
+#ifdef HAVE_LOG2
+        return log2(x);
+#else
         double m;
         int e;
         m = frexp(x, &e);
@@ -617,6 +620,7 @@
         else {
             return log(m) / log(2.0) + e;
         }
+#endif
     }
     else if (x == 0.0) {
         errno = EDOM;