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.

915 questions
120
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
  • 32,633
  • 18
  • 90
  • 113
83
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…
77
votes
5 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
  • 7,483
  • 19
  • 63
  • 131
46
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
  • 5,117
  • 3
  • 28
  • 27
31
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
  • 519
  • 1
  • 5
  • 11
23
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
  • 6,982
  • 15
  • 52
  • 99
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
  • 6,786
  • 3
  • 42
  • 72
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,014
  • 3
  • 25
  • 46
17
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,097
  • 8
  • 35
  • 65
17
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
  • 391
  • 1
  • 2
  • 12
16
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
  • 868
  • 7
  • 17
15
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…
franziga
  • 807
  • 1
  • 9
  • 29
15
votes
3 answers

Adding Linker Flags in Xcode

(I'm not sure if "flag" is the word I'm looking for, but I'll explain it.) I am trying to compile a program that uses the GMP big number library. But to be able to compile with GMP, I have to add -lgmp to the end of the command. For example, if I…
Michael Dickens
  • 1,394
  • 4
  • 16
  • 24
15
votes
14 answers

In PHP, how do I generate a big pseudo-random number?

I'm looking for a way to generate a big random number with PHP, something like: mt_rand($lower, $upper); The closer I've seen is gmp_random() however it doesn't allow me to specify the lower and upper boundaries only the number of bits per limb…
Alix Axel
  • 141,486
  • 84
  • 375
  • 483
13
votes
2 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
  • 377
  • 2
  • 3
  • 14
1
2 3
60 61