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
130
votes
6 answers

How to install GCC piece by piece with GMP, MPFR, MPC, ELF, without shared libraries?

How do I install GCC (the GNU Compiler Collection) piece by piece, using the current version, using the correct versions of dependencies, not using a package manager (like yum, rpm, apt, dpkg), and not using shared libraries? Typical developers will…
joelparkerhenderson
  • 34,808
  • 19
  • 98
  • 119
105
votes
6 answers

Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+

I downloaded GCC 4.5 from http://www.netgull.com/gcc/releases/gcc-4.5.0/ but when I try to setup / build I am getting below error: Linux:>~/shared_scripts/bin/gcc/gcc-4.5.0 1040> /x/home/prakash_satya/shared_scripts/bin/gcc/gcc-4.5.0/configure…
Programmer
  • 8,303
  • 23
  • 78
  • 162
90
votes
5 answers

What are the best (portable) cross-platform arbitrary-precision math libraries?

I’m looking for a good arbitrary precision math library in C or C++. Could you please give me some advices or suggestions? The primary requirements: It must handle arbitrarily big integers—my primary interest is on integers. In case that you don’t…
55
votes
5 answers

Pycrypto install fatal error: gmp.h file not found

It seems like there are a number of people who have had a similar problem, however, after much searching I haven't been able to find a solution that works with my particular architecture. I'm trying to install Pycrypto (as a subsidiary of Fabric)…
cosmosis
  • 6,047
  • 3
  • 32
  • 28
53
votes
12 answers

How to install GMP extension for PHP

I was getting the following error when trying to run composer update on a SimpleSAML project. - openid/php-openid dev-master requires ext-gmp * -> the requested PHP extension gmp is missing from your system. Running sudo apt-get install php5-gmp…
Sam Malayek
  • 3,595
  • 3
  • 30
  • 46
37
votes
2 answers

In R, using Ubuntu, try to install a lib depending on GMP C lib, it won't find GMP, but I have GMP installed

I want to install the Rmpfr library of R, so I type within R: install.packages("Rmpfr") This package requires the GMP C library to be installed, which in Ubuntu can be installed typing on the terminal sudo apt-get install libgmp-dev So, after I…
Celso
  • 649
  • 1
  • 6
  • 15
26
votes
3 answers

Error when configuring gmp

hope this is just a very simple question. Ok, here's what I've done: I wanted to install gmp under my Linux Ubuntu 11.10. I have both g++ and gcc on my system. So I downloaded the latest release from the gmp official site (gmp 5.0.2), extracted it…
Matteo Monti
  • 8,362
  • 19
  • 68
  • 114
22
votes
3 answers

Installing GCC from source on Alpine

While trying to install GCC 6.4.0 on Alpine, I run into: checking for the correct version of gmp.h... yes checking for the correct version of mpfr.h... yes checking for the correct version of mpc.h... yes checking for the correct version of the…
Gabriel Fernandez
  • 580
  • 1
  • 3
  • 14
22
votes
2 answers

Chudnovsky binary splitting and factoring

In this article, a fast recursive formulation of the Chudnovsky pi formula using binary splitting is given. In python: C = 640320 C3_OVER_24 = C**3 // 24 def bs(a, b): if b - a == 1: if a == 0: Pab = Qab = 1 else: …
qwr
  • 9,525
  • 5
  • 58
  • 102
21
votes
4 answers

Optimizing x64 assembler MUL loop

I'm writing math code which needs to multiply large numbers fast. It breaks down to multiplications of an array of integers with a single integer. In C++ this looks like this (on unsigned's): void muladd(unsigned* r, const unsigned* a, unsigned len,…
cxxl
  • 4,939
  • 3
  • 31
  • 52
20
votes
7 answers

c++ program using GMP library

I have installed GMP using the instruction on this website: http://www.cs.nyu.edu/exact/core/gmp/ Then I looked for an example program using the library: #include #include using namespace std; int main (void) { mpz_class a,…
Badshah
  • 431
  • 1
  • 3
  • 13
19
votes
1 answer

Number of digits of GMP integer

Is there an easy way to determine the number of digits a GMP integer has? I know you can determine it through a log, but I was wondering if there was something built into the library that I'm missing. The only thing I've found in the manual…
Darkenor
  • 4,349
  • 8
  • 40
  • 67
19
votes
5 answers

Build GMP on 64bit Windows

I have followed the instruction on the "GMP Install Instruction for Windows Platform". I could build a 32bit version of GMP which can be used for Visual Studio. ./configure --prefix=${gmp-install} --disable-static --enable-shared make make…
Franz Wong
  • 1,024
  • 1
  • 10
  • 32
18
votes
2 answers

Arbitrary-Precision Math in PHP

I'm currently trying to figure out how to work with arbitrary-precision numbers in PHP. So I guess my first question would be what exactly is arbitrary-precision math. I tried Googling for a good definition but for some reason nobody can put it in…
parent5446
  • 898
  • 7
  • 17
17
votes
3 answers

How to add a path to LDFLAGS

I'm trying to set up a library called PBC (Pairing-based cryptography). And this library requires another library called GMP -(GNU Multiple-Precision Library). My problem is after installing GMP correctly, PBC gives an error of: gmp library not…
Giuseppe
  • 447
  • 2
  • 5
  • 14
1
2 3
68 69