[Python-ideas] Add the imath module
Steven D'Aprano
steve at pearwood.info
Sat Jul 14 00:54:18 EDT 2018
On Fri, Jul 13, 2018 at 10:52:38AM -0500, Tim Peters wrote:
> Steven's numbers are pretty baffling to me, since these are all composite
> and so iterating Miller-Rabin "should get out" pretty fast:
That's because you haven't seen my code :-)
It's over-engineered, class-based, and written as a learning exercise.
There's a compatibility layer so it will work back to Python 2.4 and an
instrumentation layer which I inserted in a fit of enthusiasm to gather
staticistics, which I have never once looked at since.
And *even so* it is still fast enough for casual use at the interactive
interpreter, compared to more naive algorithms with worse Big O
performance characteristics.
You might think 5 seconds is slow, but I'm serious when I say some of
the other algorithms I played with would take *days* to generate,
or check, largish primes.
--
Steve
More information about the Python-ideas
mailing list