Questions tagged [multiprecision]

83 questions
1
vote
1 answer

boost multiprecision gmp_float convert_to() gives compilation error

I am using boost multiprecision library floating point number. I need to map a gmp_float to an tanh and then take it as a double because value of tanh will be [0, 1). When I use convert_to() I get compilation error as shown in the snippet…
Neel Basu
  • 12,638
  • 12
  • 82
  • 146
1
vote
3 answers

Multi-precision addition implementation

I am trying to implement multi-precision arithmetic for 256-bit operands based on radix-2^32 representation. In order to do that I defined operands as: typedef union UN_256fe{ uint32_t uint32[8]; }UN_256fe; and here is my MP addition…
A23149577
  • 2,045
  • 2
  • 40
  • 74
1
vote
0 answers

Implementing Karatsuba multipilcation in radix-2^32 representation (C code)

I am trying to implement level-3 Karatsuba multiplication for multiplication of two 256-bits operands. I want to use radix-2^32 representation of my operands, therefore I have implemented schoolbook multiplication of two 32-bit operands so far which…
A23149577
  • 2,045
  • 2
  • 40
  • 74
1
vote
1 answer

create new cpp_dec_float types with specific precision

I am running physical simulation using c++, and for precise results I am using boost::multiprecision. so far I used the cpp_dec_float_50 type, however ,now I need to test the simulations for diffrent variables with different precision. so, how do I…
bnaya
  • 93
  • 3
1
vote
1 answer

Boost multiprecision : Recursive template instantiation exceeded maximum length 256

Trying to play a little bit with boost's multiprecision numbers I got the following error In file included from main.cpp:1: In file included from /usr/include/boost/multiprecision/cpp_int.hpp:12: In file included from…
Lezkus
  • 160
  • 1
  • 12
1
vote
1 answer

Boost Multiprecision random generator seed error

I have been following the documentation from the boost library to generate multiprecision random integers but In the documentation it is not mentioned how to set the seed. I can't figure how to set the seed without getting compilation…
1
vote
1 answer

Why I cannot use neither std::unordered_map nor boost::unordered_map with boost::multiprecision types?

I am trying to create a STL (or boost) unordered_map with boost::mulprecision types e.g. cpp_int but gcc throws errors after trying to insert elements to this container. #include #include…
Patryk
  • 22,602
  • 44
  • 128
  • 244
1
vote
2 answers

Using Boost.Random to generate multiprecision integers from a seed

I am attempting to use the Boost multiprecision libraries for C++ to generate large random numbers. I have been unable to create a generator which is seeded by the time or another random number, so my generator produces the same numbers on every…
Jonathan Basile
  • 649
  • 1
  • 10
  • 20
1
vote
1 answer

working with boost multiprecision/mpfr float - string could not be interpreted as valid integer error

I have written a program which performs some simple arithmetic with very large numbers. I succeeded in using mpz_int and mpf_float from the boost multiprecision libraries, but found that i needed more precision to achieve my purpose. I have been…
Jonathan Basile
  • 649
  • 1
  • 10
  • 20
1
vote
1 answer

Multi-precision floating-point `scipy.misc.comb`

I am using mpmath to write a binomial beta function fit to calculate extremely small probabilities. Most of the functions I need are already included in mpmath or easy to rewrite. Sadly, however, scipy.misc.comb is not. I tried looking at the source…
TheChymera
  • 17,004
  • 14
  • 56
  • 86
1
vote
0 answers

Why does Boost.Multiprecision not use the largest possible word size?

I have noticed that cpp_int backend of Boost.Multiprecion library uses 32-bit unsigned integer as a word (limb) on 64-bit architecture. The requirement for 64-bit word to be used is availability of native 128-bit integer in compiler (that might be a…
Paweł Bylica
  • 3,780
  • 1
  • 31
  • 44
1
vote
2 answers

boost::multiprecision : How to convert a mpz_int variable to gmp_int?

I have converted a mpz_int to gmp_int by converting a mpz_int to mpz_class and then converting the mpz_class instance to a gmp_int. Is there an easier way to do it ? thanks
user3664264
  • 31
  • 1
  • 3
1
vote
2 answers

boost::multiprecision::cpp_int: I would like to confirm that division of two positive cpp_int's truncates towards zero

I am using boost::multiprecision::cpp_int, and I cannot find confirmation that division of two positive cpp_int's truncates towards 0; i.e., that boost::multiprecision::cpp_int A {11}; boost::multiprecision::cpp_int B…
Dan Nissenbaum
  • 13,558
  • 21
  • 105
  • 181
1
vote
1 answer

can multiprecision signed multiply be performed with imul instruction?

I am writing a function library to provide all conventional operators and functions for signed-integer types s0128, s0256, s0512, s1024 and floating-point types f0128, f0256, f0512, f1024. I am writing the s0128, s0256, s0512, s1024 multiply…
honestann
  • 1,374
  • 12
  • 19
0
votes
1 answer

Boost multiprecision rounding towards 0

The code below compiles just fine on Windows using VC++: #include #include #include namespace mp = boost::multiprecision; using BigFloat =…
Vega4
  • 969
  • 1
  • 11
  • 25