Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c++
Subject: Re: Bignum multiplication in Python vs GMP (was: constexpr is really very smart!)
Date: Thu, 26 Dec 2024 18:54:59 -0800
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <86ed1tded8.fsf@linuxsc.com>
References: <20241216112808.00003f74@yahoo.com> <86jzbyghdw.fsf@linuxsc.com> <20241218013342.0000518a@yahoo.com> <20241218135131.00000006@yahoo.com> <86zfksf4lb.fsf@linuxsc.com> <20241220021703.00003e9e@yahoo.com> <86msgqezb8.fsf@linuxsc.com> <20241222000708.000007ef@yahoo.com> <86a5cnfubs.fsf@linuxsc.com> <20241223174708.000062b3@yahoo.com> <86ttatcj2x.fsf@linuxsc.com> <20241225110505.00001733@yahoo.com> <20241225133308.000025fd@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Fri, 27 Dec 2024 03:55:02 +0100 (CET)
Injection-Info: dont-email.me; posting-host="ce9c96fed16de83e8c7d4f3eabb78d96"; logging-data="3431812"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18phK8wGwtOgvDFQHSvBrJ+1gt7KwAS/24="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:4isEv8rZ0lqshroLVUAeOQxtuns= sha1:kyVoLiQ+I+vUHkXGAB+9J8SpRYA=
Xref: csiph.com comp.lang.c++:121303
Michael S writes:
>> [GMP in python?]
>
> Forgot to mention.
> As said in the same redit thread, one can use GMP from python. It's
> pretty easy, just not the default.
>
> [example]
Thank you, that is good to know.
> For big values of n gmpy2-based variant calculates Fibbonaci numbers at
> approximately the same speed as C variant. For smaller numbers - not
> quite the same as C and for n < ~10,000 it is slower than default
> python math.
So now we need a hybrid method where "small" numbers use default
python algorithms and advance to GMP for larger numbers, with each
of those two already being hybrids? A hybrid**2 algorithm? I like
it. ;)
By the way, in the last week or so I sent you two emails. Could I
ask you to send a short email in response (assuming they arrived,
which I expect they did)?