Open timotheecour opened 3 years ago
I will look into this feature.
@xflywind what's your proposed approach?
What I have in mind is something like std/nre
which wraps pcre
library in a user friendly (YMMV) API.
Key features:
The mp++ code itself is licensed under the MPL-2.0 license, but of course mp++ has a dependency on GMP. I am not a lawyer, but given that GMP is used in commercial computer algebra systems (Mathematica, Maple, ...) I am assuming there are no licensing conflicts with MPL-2.0 (of course as long as you are picking the LGPL in GMP's dual-iicense scheme).
LGPL could be a problem depending on use cases but if we can provide a fixed nim interface that allows swapping in different underlying libraries (gmp, mp++, a partial nim re-implementation, etc) then the licensing issue kind of goes away: the user would then be able to swap in a (supported) library of their choosing, depending on performance vs licensing terms.
we could start with just bigints, but make the design extensible to all the features that mp++ offers (refs https://github.com/bluescarni/mppp)
Do you have seen this library? http://www.libtom.net
https://github.com/libtom/libtommath
All LibTom Projects are either under WTFPL or The Unlicense and free for all purposes
There are many license friendly libraries in this list https://en.wikipedia.org/wiki/List_of_arbitrary-precision_arithmetic_software
It seems that the bignum implementation on V8 is not too complex too https://github.com/v8/v8/blob/master/src/numbers/bignum.cc
Python/Erlang/PHP C implementation Zig - Pure zig implementation https://tiehu.is/blog/zig2.html Crystal - GMP
Or we could provide backend switch options(Pure Nim and GMP) like haskell https://gitlab.haskell.org/ghc/ghc/-/tree/master/libraries/ghc-bignum/src/GHC/Num
I would like Pure-Nim implementation like D(https://dlang.org/phobos/std_bigint.html)
Performance is optimized for numbers below ~1000 decimal digits. For X86 machines, highly optimised assembly routines are used.
Some random benchmarks https://news.ycombinator.com/item?id=6990233
thanks for the links! https://www.libtom.net/TomsFastMath/ should be used instead of libtommath though
It is a port of LibTomMath with optional support for inline assembler multipliers Uses similar API as LibTomMath makes porting easy Faster than OpenSSL on the AMD64
we need to find benchmarks comparing gmp vs TomsFastMath
links
nim
c, c++
other
TomsFastMath
libtom https://www.libtom.net/TomsFastMath/
hebimath
suiginsoft/hebimath: arbitrary precision arithmetic library
v8
benchmarks
gmp
languages using gmp through ffi:
bsdnt
wbhart/bsdnt: BSD Licensed Bignum Library