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
0
votes
1 answer

GMP(MPIR) linker errors on linux

I wrote a public-private key generator using mpir(on windows) and it works fine. When I try to compile it on a linux machine using gmp library, it throws a whole bunch of linker errors. /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info):…
questions
  • 2,337
  • 4
  • 24
  • 39
0
votes
1 answer

Error installing GMP

I'm on OSX Lion using TextMate to write my C++ programs. I wanted to deal with some large numbers and thus tried installing GMP. Here's what I did. I installed gmp 5.0.4 from gmplib.org After downloading, I navigated to the directory in terminal…
cortex
  • 699
  • 2
  • 7
  • 11
-1
votes
0 answers

can not include gmp.h lib on linux

I try to include static library gmp.h but Linux can not see it. Terminal output like this: gcc -Wall -Werror -Wextra -std=c11 -D OS_LINUX -I/../materials/LINUX_gmp_lib/include/ -L/../materials/LINUX_gmp_lib/lib -lgmp -c s21_*.c ar rc s21_decimal.a…
-1
votes
0 answers

I have a segmentation error in a program that generates mandelbrot fractal with mpfr

Recently I modified my mandelbrot fractal generation program to be able to integrate gmp and mpfr in order to zoom deeper into the fractal. But since I did this I have a segmentation error when I try to run the program I’m pretty new to c language…
ena0
  • 1
  • 1
-1
votes
1 answer

rust-gmp-kzen gmp bind problem : "dyld[...]: missing symbol called"

I am using rust-gmp-kzen library which bind rust to gmp. When I run the rust program, it aborts at the statement "BigInt::one();" which calls "__gmpz_init_set_ui" in it. I reinstall gcc, gmp, rustup vs. however problem still occurs. dyld[77446]:…
-1
votes
1 answer

C compiler not finding gmp linked library

I'm trying to compile a simple C program on an M1 Mac that includes gmp.h. For whatever reason, however, it continuously says that it can't find the library. I checked to see if it exists via locate libgmp.a to which it says it is located in…
-1
votes
1 answer

GMP's mpf division with a 0 result

When using GMP lib,I get a all-0 result like that in the image after using GMP C function mpf_div(),all-0 result.I have already put a line of codes to set the default precision but you can see,only the first result is correct and the rest are not…
-1
votes
1 answer

Cairo on M1 chip (gmp.h) error fixed solition

To make mine more generic, try: CFLAGS=-Ibrew --prefix gmp/include LDFLAGS=-Lbrew --prefix gmp/lib pip install ecdsa fastecdsa sympy
zinderud
  • 27
  • 2
-1
votes
1 answer

GMP demo primes.c CMD syntax for arg fields?

I got GMP to compile, however, when I try to run the demo "primes.c" I am unable to figure out the correct syntax. Every time I've run the program I get the below output: usage: ./primes [-c] [-p] [-g] [from [+]]to I have devolved into just…
MFerguson
  • 1,739
  • 9
  • 17
  • 30
-1
votes
1 answer

PHP: Read 8 bytes of timestamp from file on 32bit platform using gmp library

Trying to read timestamp in nanosecs(8 bytes) this way: $fp = fopen($binFile, 'rb'); ... fseek($fp, $current * $event_len, SEEK_CUR); // Read 8 bytes of timestamp apart $ts_lo = fread($fp, 4); $ts_hi = fread($fp, 4); $ts = $ts_hi.$ts_lo; $gmp =…
tzi0
  • 537
  • 2
  • 5
  • 12
-1
votes
1 answer

Is there a way I can convert mpz_t to int or unsigned long int in C++?

I have data in mpz_t and I want to assign that data to int or unsigned long int. The data/numbers are small in mpz_t and can be stored into in back. Is there a way I can accomplish this?
-1
votes
2 answers

What is the type of mpfr_t and how do I make a C function of this type?

I've just started using the GMP and MPFR. I'm writing a program in C and would like to make a function that (for example) takes as input an mpfr_t variable and returns an mpfr_t variable. I'm not sure of the definition of mpfr_t, but I tried naively…
-1
votes
1 answer

How to call the functions of paillier library

I want to call the functions of paillier library (http://acsc.cs.utexas.edu/) in C++ environment. I found out the helpful site (Typedef function with void * pointer) and followed the comment answered Feb 10 '15 at 12:40 from Niemand. But, my code…
user2642459
  • 507
  • 3
  • 10
  • 18
-1
votes
1 answer

sizeinbase for mpz_class in GNU GMP

In C we have mpz_t and we can access the size in a base by size_t mpz_sizeinbase (const mpz_t op, int base) In mpz_class, I've tried counter.sizeinbase(2); that didn't work. error: ‘mpz_class {aka class __gmp_expr<__mpz_struct [1], __mpz_struct…
kelalaka
  • 5,064
  • 5
  • 27
  • 44
-1
votes
1 answer

calculate IPV6 range from start ipv6 and end IPv6

i am trying to calculate ipv6 range with the help of gmp library. eg: start IP: FE80:CD00:0000:0CDE:1257:0000:211E:729B end IP: FE80:CD00:0000:0CDE:1257:0000:210D:729E i have start and end of ipv6 . i want all ip between start and end…
Manoj
  • 118
  • 12