Questions tagged [gmp]

The GNU Multiple-Precision Library (GMP) is a mature, free library for arbitrary-precision arithmetic with support for big signed integers, rational numbers, and floating point numbers. The basic interface is for C but wrappers exist for other languages including Ada, C++, C#, OCaml, Perl, PHP, and Python. It is distributed under the GNU LGPL and is used for cryptography applications and in computer algebra systems such as Mathematica and Maple.

GMP, or GNU Multiple Precision Arithmetic Library, is a library allowing for arbitrary precision arithmetic. This means that calculations using the libraries internal variables are not limited to ordinary constraints of bit-level precision that many languages inherently possess.

It can support multiple different data types including floating-point numbers, signed integers and rational numbers. It is primarily used in areas related to cryptography, and is also heavily used in numerical research, other types of security applications and computational algebra.

Full words are used as the intrinsic data type, and logic is used to select separate algorithms depending upon the operand size for efficiency purposes. Critical parts of the library utilize Assembly code and is specialized for different processing units to further increase efficiency.

GMP is designed to run on systems running Unix derivates including Linux and Solaris, but may also work on 32-bit and 64-bit Windows machines.

The manual and information to get started using GMP are located here :

https://gmplib.org/manual/

1024 questions
5
votes
2 answers

How to initialize a mpz_t in gmp with a 1024-bit number from a character string?

I want to initialize a mpz_t variable in gmp with a very large value like a 1024 bit large integer. How can I do so ? I am new to gmp. Any help would be appreciated.
XyZ
  • 51
  • 1
  • 1
  • 2
5
votes
3 answers

Installing PHP 7.3 on a new MacBook Pro with the new A1 chip (Apple silicon)

I am trying to install HD-Wallet Derive on my new MacBook Pro with the Apple A1 chip. For which I need to install the latest version of PHP (7.3 at this current time). So when I hit this command brew install php@7.3 on my terminal (Z shell) and I…
vmieres
  • 91
  • 1
  • 1
  • 7
5
votes
1 answer

Why adox and adcx don't play well together on Ryzen?

I spent quite a lot of time hand-optimizing low-level integer arithmetic, with some success. For instance, my subroutine for 6x6 multiplication spends 66 ticks compared to 82 ticks of mpn_mul_basecase(6,6) on Skylake. My code is published on…
5
votes
2 answers

How to enable php-gmp on Mac OS X 10.6.6? (no macports)

I want to enable my php-gmp and I don't want to use macports because I use homebrew. First I brew install gmp and I got gmp 5.0.1 Then I downloaded the PHP source 5.3.6, then I go to source/ext/gmp I did phpize and then…
hSATAC
  • 301
  • 3
  • 8
5
votes
3 answers

Restore a number from several its remainders (chinese remainder theorem)

I have a long integer number, but it is stored not in decimal form, but as set of remainders. So, I have not the N number, but set of such remainders: r_1 = N % 2147483743 r_2 = N % 2147483713 r_3 = N % 2147483693 r_4 = N % 2147483659 r_5 = N %…
osgx
  • 90,338
  • 53
  • 357
  • 513
5
votes
3 answers

How to compile GMP for windows using Visual Studio

I am trying to install gmp on windows. I have found the mingw way of compiling from sources on windows. But was unable to find binaries fro gmp 6.1.2 or visual studio project in order to compile from sources. So the question is: Where can I…
user2420079
  • 251
  • 3
  • 17
5
votes
5 answers

How does one calculate 2 ^ -18 using GMP?

I've just discovered, to my embarrassment, that feeding negative exponents to mpz_pow_ui doesn't work very well. ("The manual does say unsigned long, you know.") For the other mpz_pow functions, the manual uses concepts I don't understand. For…
bugmagnet
  • 7,631
  • 8
  • 69
  • 131
5
votes
1 answer

Error when attempting to use a type from GNU's GMP library as the yylval type for Bison

I'm attempting to use the type mpz_t from the GMP library as the type for yylval by including the following in the Bison file: %define api.value.type {mpz_t} I checked the generated parser and it correctly generates the line typedef mpz_t YYSTYPE,…
jeff
  • 8,300
  • 2
  • 31
  • 43
5
votes
2 answers

GMP mpz_array_init is an obsolete function - How should we initialize mpz arrays?

Having only used the GNU MP Bignum Library a few times, I was interested to see that the way I had previously allocated/initiated arrays is now obsolete. From Integer Special Functions: 5.16 Special Functions The functions in this section are for…
AGS
  • 14,288
  • 5
  • 52
  • 67
5
votes
2 answers

Install GMP library on Mac OS X 10.9 and Xcode

My question is as simple as the title. I have a Macbook Pro with OS X Mavericks (10.9.4) and Xcode (5.1.1). I need to install the GMP arbitrary precision libraries so that I can just get to write GMP-enabled programs from within Xcode. I downloaded…
Matteo Monti
  • 8,362
  • 19
  • 68
  • 114
5
votes
1 answer

C++ gmp and homebrew

I'm on a mac and I've installed gcc and gmp through homebrew. To test out my installation I've tried out the simple example from here: #include #include using namespace std; int main (void) { mpz_class a, b, c; a = 1234; b =…
math4tots
  • 8,540
  • 14
  • 58
  • 95
5
votes
1 answer

Searching for Embedded C library to operate on Big numbers which do not use standard libc?

I have to operate on Very large numbers may be 2048 bytes for implementation of RSA. As per the rules of Automotive domain i cant use bignum library which uses standard libc. I have searched for GMP and Polarssl but they all uses malloc() and other…
5
votes
2 answers

gmp.h file not found error in Xcode, mac

I downloaded gmp-6.0.0a.tar.xz file and unzip(tar) in usr/local directory. As people said , I typed ./configure, make, make check and sudo make install in the gmp-6.0.0 directory. Installing seemed fine. But when i tried to test like…
Q123
  • 319
  • 5
  • 16
5
votes
1 answer

Using vectors with GMP

I'm trying to use vectors with GMP. But when I compile anything like this, I get "[...]\bits\vector.tcc [Error] array must be initialized with a brace-enclosed initializer". Any data structure with dynamic size works - a deque would be best but…
Spitemaster
  • 151
  • 1
  • 7
5
votes
5 answers

How to solve "Call to undefined function dbase_open() " error in windows

Hi i want to load DBF file to mysql, am using xampp,php version 5.5.6 i had write the below code, But am getting Error --- Fatal error: Call to undefined function dbase_open() in C:\xampp\htdocs\imports\import_geo.php on line 47 $dbf =…
chaitra
  • 83
  • 1
  • 2
  • 9