Questions tagged [boost-multiprecision]

Boost library for numeric types with arbitrary precision.

This library allows to create numeric types with a greater precision than default types like double int and so on.

59 questions
0
votes
0 answers

Cannot programmatically change boost multiprecision mpfr precision

Keep in mind that Precision is based on the total number of digits and not the decimal places, but I need a way to set the Decimal places and all I can find is Precision, so I am trying to work with it, so I account for the number of digits in the…
user83395
  • 93
  • 1
  • 6
0
votes
1 answer

Issues with Math Precision using boost multiprecision

I am converting a bash script to a Qt Qml Felgo app called Galaxy Calculator and I need to calculate the circumference of the Galaxy, Floating Point failed by 100 miles in the calculation, using JavaScript of C++, the numbers are way to big for a…
user83395
  • 93
  • 1
  • 6
0
votes
0 answers

Code works with Boost Multiprecision Library floats, but not with GMP backend

I am learning how to use Boost Multiprecision Library. As an exercise, after following the following the Distribution Construction Example, I was able to successfully implement a function that calculates the Negative Binomial PDF with high-precision…
blipblop
  • 145
  • 11
0
votes
1 answer

boost::multiprecision: What's the cheapest way to multiply or divide by a huge power of 10? Something like bitshift op for powers of 10?

Consider the following MCVE: #include #include int main() { boost::multiprecision::cpp_int x = 10; x *= 10000000000000000000000000000000000000000000000000000000000000; …
The Quantum Physicist
  • 21,050
  • 13
  • 77
  • 143
0
votes
3 answers

How do I convert an array of bytes to a boost::multiprecision::uint128_t?

If I have: char buffer[16]; How can I convert its raw bytes into a: boost::multiprecision::uint128_t ? I tried doing a standard C-style cast: uint128_t myInt = *(uint128_t*)buffer; though it doesn't seem to work properly. Also tried using a…
csm10495
  • 390
  • 4
  • 10
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
1 answer

customizing the number of digits in exponent in boost multiprecision

We've just migrated to Visual Studio 2017 and due to the change described here the serialized output of a double value using std::scientific does not carry anymore 2 digits in the exponent but only one. BEOFRE: 5.49000000000000000e+002 NOW :…
Abruzzo Forte e Gentile
  • 13,055
  • 24
  • 87
  • 163
0
votes
0 answers

Rcpp and Boost Multiprecision,

I want to use boost/multiprecision with Rcpp. Therefore I looked around and found these threads about boost: one and two. The first one about quad-precision is exactly what I want to use. The problem is that I cannot compile the given example.…
Vandenman
  • 2,542
  • 14
  • 30
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
  • 11,848
  • 10
  • 71
  • 138
0
votes
1 answer

Why does this memoized code segfault?

I have the following code that computes the Stirling number of the second kind for a given n and k, #include #include #include namespace mp = boost::multiprecision; mp::cpp_int…
0
votes
0 answers

Using boost multi precision operator instead of a const double one

I have the following code for integration by boost library. Iam tried to change the double operator to cpp_dec_float_50 operator. #include #include #include…
Sarah
  • 9
  • 3
0
votes
1 answer

Integration with quadrature and multiprecision boost libraries in C++

after searching i had found amazing code for integration by quadrature boost library. rather than log(x)/(1+x) want to integrate (poly[0]+poly[1]*x+poly[2]*x^2+...+poly[n]*x^n)*log(x)/(1+x). But, i do not know how to insert the vector…
Sarah
  • 9
  • 3
-1
votes
1 answer

How can I generate random multiprecision ints of different bits using boost?

I need to generate a large number of random multiprecision ints (boost mpx_int) of various bits. My current approach is based on these two examples: boost multiprecision random, constexpr array. To generate a random number this way I need the number…
ryn1x
  • 843
  • 1
  • 6
  • 15
-2
votes
1 answer

How to use the C++ max function with boost 128 bit integer

If I have the following code: #include using namespace boost::multiprecision int main() { int128_t a = Func_a() int128_t b = Func_b() std::cout << std::max(a, b) << std::endl; return 0; } And if…
user6542719
1 2 3
4