Sujet : Re: Python recompile
De : bc (at) *nospam* freeuk.com (bart)
Groupes : comp.lang.cDate : 11. Mar 2025, 22:18:34
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vqq9ba$267fp$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
User-Agent : Mozilla Thunderbird
On 11/03/2025 20:20, David Brown wrote:
On 11/03/2025 18:47, bart wrote:
<https://packages.msys2.org/packages/mingw-w64-ucrt-x86_64-gmp>
<https://packages.msys2.org/packages/mingw-w64-ucrt-x86_64-libffi>
>
The compressed tarballs include the dlls.
>
I downloaded a couple of large files, including mingw64-x86_64- gmp-6.3.0-1-src.tar, but found no trace of any DLL files.
You downloaded the source tarballs, and are surprised to find they contain source files - not binaries? Did the abbreviation "src" not give you a clue?
You said the 'tarballs include the dlls'. I associate tarballs with source code, so I was mildly surprised, but I looked anyway. The other file was mingw-packages.master.zip, but it would have taken forever to unzip the lot looking for one file that probably wasn't there.
Try the link that is labelled "File:" - it is the msys2/mingw-w64 tarball with libgmp-10.dll and all the other files shown in the list at the bottom of the page, under "Files:".
So:
https://mirror.msys2.org/mingw/ucrt64/mingw-w64-ucrt-x86_64-gmp-6.3.0-2-any.pkg.tar.zst, obviously.
Meanwhile here is the library *I* had to use instead:
>
https://github.com/sal55/langs/tree/master/bignum
>
It is not exactly comparable, is it?
No. Mine was available when I needed it a decade or so ago. GMP dlls were everywhere, mostly on dodgy-looking sites but every one was different. Then you had the job of finding a matching gmp.h file.
If all you need is some simple arithmetic done in a naïve school long multiplication way, then the code is fine.
I needed support for big numbers in my interpreter. My product is well-integrated, and represents 5% of the 250KB interpreter size. The above gmp DLL is 666KB so is a poor match.
Your code is a reasonably clear and straightforward implementation of that. If you have no need of more than that, there is little point in going for something as powerful as GMP - it is probably faster to write such code than it is to learn how to use GMP.
My library has some special features such as using decimal, and supporting arbitrary floating point within the same type. This is it in use within my scripting language:
a := 2e1'000'000'000L
b := 3e1'000'000'000L
println a+b
println a*b
println a/b
Output is:
5.0e1000000000
6.0e2000000000
0.666666...666 (default precision is 300 decimals)