Questions tagged [multiprecision]

83 questions
0
votes
2 answers

Is there a more elegant way to read a Textfile containing mpz values into a list of integers?

I have a Textfile containing numbers that looks as follows: [mpz(0), mpz(0), mpz(0), mpz(0), mpz(4), mpz(54357303843626),...] Does there exist a simple way to parse it directly into an integer list? It doesn't matter whether the target data type is…
Eldar Sultanow
  • 205
  • 2
  • 9
0
votes
1 answer

Fastest way to sum dot product of vector of unsigned 64 bit integers using 192/256 bit integer?

I need to calculate dot product of two vectors: uint64_t a[N], b[N]; (N<=60) containing 64-bit unsigned integers. Precisely this loop: unsigned __int128 ans = 0; for(int i=0;i
madhur4127
  • 276
  • 2
  • 13
0
votes
1 answer

I receive a fatal error with boost and Rcpp

As described in the post: Rcpp and boost: it should work but it does not I am trying to use boost in Rcpp in Windows. The (simplified) file is: // [[Rcpp::depends(BH)]] #include #include namespace mp =…
0
votes
2 answers

Define struct in the heap with different sizes

I am trying to implement a bigInt library. I have been checking other libraries like GMP, ttmaht or libtommath but any of them fulfill the requirements of the project (because licenses, because they only use the stack, etc) I will follow the…
JomsDev
  • 116
  • 1
  • 9
0
votes
0 answers

wrong result boost gmp float

I need to compute 5^64 with boost multiprecision library which should yield 542101086242752217003726400434970855712890625 but boost::multiprecision::pow() takes mpfloat and gives 542101086242752217003726392492611895881105408. However If I loop and…
Neel Basu
  • 12,638
  • 12
  • 82
  • 146
0
votes
1 answer

C++ How can I assign a datatype to a binary sequence?

I have a binary sequence. This sequence represents an arbitrary precision integer but as far as the computer is concerned, it's just a binary sequence. I'm working in C++, with the multiprecision library. I only know how to assign values to the…
Benn
  • 61
  • 1
  • 1
  • 3
0
votes
0 answers

precision multiplication of 255-bit integer in radix-2^16

I would like to implement the precision multiplication of 255-bit integer in radix-2^16 in C. I have been suggested to present such big number as an array of bignumber[16] ( typedef uint16_t bignumber[16] ). However, I don't get the intuition behind…
0
votes
1 answer

Insert an `__asm__` block to do a addition in very large numbers

I am doing a program, and at this point I need to make it efficient. I am using a Haswell microarchitecture (64bits) and the 'g++'. The objective is made use of an ADC instruction, until the loop ends. //I removed every carry handlers from this…
0
votes
0 answers

ARM inline assembly multi-precision multiplication

I am new to ARM assembly, and I want to implement one of my C functions in inline assembly. My functions is multi-precision multiplication which multiplies 32-bit unsigned integer with 256-bit unsigned integer and put the result into 288-bit…
A23149577
  • 2,045
  • 2
  • 40
  • 74
0
votes
2 answers

Big integer division with operands aproximately of the same size

I'm trying to implement a function that computes the division between two numbers approximately of the same size. I use an array of unsigned int's to store the values of each number (see below the class structure). I want to implement an efficient…
fc67
  • 409
  • 5
  • 17
0
votes
1 answer

Where can I find a (C++ specific) unlimited integer class that works well with boost::rational?

I want to work with rational numbers whose numerator and denominator can go well above the limit of even long long int's, and boost::rational is a nice class that was specifically designed for unlimited integer types. But when I look up what…
Izzhov
  • 163
  • 4
0
votes
1 answer

How to keep precision of gmpy2 mpfr in Numpy matrix operation

I am using Multiple-precision Rationals(mpfr) object in Numpy matrix, matrix([[ mpfr('-366998.93593422093364191959435957721088073331222596080623233278164906447646654043966366647797',300), …
PytLab
  • 539
  • 6
  • 12
0
votes
1 answer

Writing HugeInteger class

I am new to C++ and this is what I am suppose to do for an assignment. Create a class HugeInteger that uses a 40-element array of digits to store integers as large as 40 digits each. Provide member functions input, output, add and subtract. For…
0
votes
3 answers

Floating-point type with extended range

I need to represent floating-point numbers of very small orders (for example, 0.6745 × 2-3000) in C. It is necessary that such support was platform independent (works on both the CPU and GPU-CUDA). The big length of the significand is not…
Konstantin Isupov
  • 199
  • 1
  • 2
  • 12
0
votes
1 answer

creating math constants of variable precision using Boost mpfr_float, such as pi or e

I am using Boost.Multiprecision for wrappers around the mpfr backend, and I am having some trouble creating pi (and e or any other math constant) to my desired precision. I feel like what I want to do should be possible, because of the use of…
ofloveandhate
  • 199
  • 1
  • 10