STINNER Victor <victor.stin...@haypocalc.com> added the comment: > Thanks, Victor. I suspect we're going to need to be a bit more > careful, though: when the extra tests were added for math.log, it > turned out that it had all sorts of strange special-case behaviour on > various platforms. > > So I suspect that even on platforms that have log2 natively, it'll be > necessary to factor out special cases and deal with those first, only > passing positive finite floats onto the system log2. Take a look at > m_log and the comment directly above it to see how that works.
Oh, I see: /* Various platforms (Solaris, OpenBSD) do nonstandard things for log(0), log(-ve), log(NaN). Here are wrappers for log and log10 that deal with special values directly, passing positive non-special values through to the system log/log10. */ > I'd also like to check in the non-system version first, just to give > it a thorough test on the buildbots, before adding in the version that > uses the system log2 when available. Yes, we can use log2() only for the "x > 0.0" case. My secret plan was to check system log2() using the buildbots. But if we know that system log() only works correctly with strictly positive numbers, it's faster to directly only use system log2() for x > 0.0. Updated patch (version 3) implements that. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11888> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com