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
-2
votes
2 answers

Static build of GMP for MSVC (Windows)

Is it possible to build GMP for MSVC on Windows? I need fully static solution (static library), without any DLL dependencies. So that my final EXE doesn't depend on any external (non-system) DLLs. I'm alright if building GMP will need Cygwin or…
Arty
  • 14,883
  • 6
  • 36
  • 69
-2
votes
1 answer

C: Trouble with GMP pointers in a struct

I'm fairly new to c and I'm implementing a DHT. For that, I have to store node IDs in a list. Node IDs are < 2^160 whole numbers(thus resulting in me using GMP), but I'm setting 123 as an ID here to keep the example clean. I am able to set the…
Aarnav
  • 3
  • 1
-2
votes
1 answer

How to fix code that works with some values but not with others

when i enter some values i get the answer but other values no,the system stay blocked int pgcdfon(mpz_t a, mpz_t b, mpz_t *x, mpz_t *y) { if (mpz_cmp_ui(a, 0) == 0) { mpz_set_ui(*x, 0); mpz_set_ui(*y, 1); return b; } …
Zineb
  • 9
  • 4
-2
votes
1 answer

Inverse of a mpz_t number in GMP

I want to do a inverse operation on a mpz_t type number. I see we have int mpz_invert(mpz_t rop, const mpz_t op1, const mpz_t op2) function, which only gives inverse of (op1 % op2). How can I just get inverse of op1 (mpz_t) ?
katik
  • 1
  • 3
-2
votes
1 answer

mpir.dll was not found when try to run gmp

I use Visual Studio Community 2017 x64, Windows 10, for C++. I cannot run gmp code because of the following error: the code execution cannot proceed because mpir.dll was not found. Reinstalling the program may fix this problem Can anyone help me?
Haz
  • 11
  • 1
-2
votes
1 answer

How to initialize a GMP mpz_t with an integer

I want to initialize a mpz_t from GMP with an integer (e.g. 2). I've tried the following variants: mpz_t n(2); // Compiler error mpz_t n = 2; // Compiler error What is the correct way of initializing the mpz_t to 2?
Uli Köhler
  • 13,012
  • 16
  • 70
  • 120
-2
votes
1 answer

Segmentation fault (core dumped) while using GMP Integers

I wrote a simple program in C++, using the gmp library, which prints out the modulus of numbers which's digits are composed of 1 (like 1, 11, 111, 1111, 11111, ...) and 2001; problem is when the program reaches 23 digits of 1, I get an error saying…
user4807452
-2
votes
1 answer

Run program with GMP on school computer

I want to run a program I wrote that uses GMP library at my school, however I need your help getting this to work. The program itself is okay, but I can't figure out how to properly include GMP. I am using Netbeans IDE and cygwin, the program is in…
Jelle
  • 36
  • 6
-2
votes
2 answers

Installation of GMP PHP library in XAMPP doesn't work

I try to use the GMP library for big integers in PHP. I use XAMPP, PHP 5.5.11, and Ubuntu 14.04. According to several sources it should be as easy as that: run sudo apt-get install php5-gmp put extension=php_gmp.so or extension=gmp.so in…
Watchduck
  • 1,076
  • 1
  • 9
  • 29
-2
votes
1 answer

Seg Fault 11, (issue with GMP and initialisation??)

I have a segmentation fault 11 in this piece of code (edit:no longer shown). Having been told to get a debugger and to sort my arrays out I have edited the code to fix the arrays to go from 0. I also installed valgrind and ran it but it is limited…
adrem7
  • 388
  • 1
  • 3
  • 14
-3
votes
1 answer

How to use GMP library in dev c with gcc4.7.2

I have absolutely no idea about using gmp. Need some functions for a project and need a quick installation guide. I am Absolutely beginner to this field so please help accordingly. I have: Dev C++ 5.4.2 in windows 8.1 configuration with GCC4.7.2…
Paras Rautela
  • 56
  • 1
  • 7
-3
votes
1 answer

C++ GMP, why does this throw an error?

mpz_t* myArr= new mpz_t[M+1]; cout << myArr[0] << endl; cin.get(); //so I know the program pauses here if everything's OK so far M is a long long datatype. I've also tried mpz_t* myArr= new mpz_t[M+1]; mpz_set_si(myArr[0],0); cout << myArr[0] <<…
MyNameIsKhan
  • 2,594
  • 8
  • 36
  • 56
-3
votes
1 answer

Is there any way to check correctness of the mpz_mul function?

Is there any way to check correctness of the mpz_mul() function from GMP.
-4
votes
1 answer

GMP PHP Extention Missing

I want to test run a completely developed site. While i was in location "localhost/install/" called "Easy Installer by Viserlab" there is showing GMP PHP Extension is Required. How I can install it and where to.
-4
votes
1 answer

How to compile GCC cross-compiler?

I am trying to compile GCC for i586-elf but every time I run the 'configure' file with this command: ./configure --target=$TARGET --prefix=$PREFIX --disable-nls --enable languages=c --without-headers --with-gmp=$PREFIX…
1 2 3
68
69