Questions tagged [mpfr]

The MPFR library is a C library for multiple-precision floating-point computations with correct rounding.

The MPFR library is built on the GNU Multi-Precision Arithmetic Library. It is licensed under the GNU LGPL v3 (or later versions).

The MPFR library is a C library for multiple-precision floating-point computations with correct rounding.

The main goal of MPFR is to provide a library for multiple-precision floating-point computation which is both efficient and has a well-defined semantics. It copies the good ideas from the ANSI/IEEE-754 standard for double-precision floating-point arithmetic (53-bit significand).

Both GMP and MPFR (and also MPC) are prerequisites when building the GNU Compiler Collection.

198 questions
2
votes
1 answer

How MPFR Library Calculation Accuracy Works

I confess that I am having trouble understanding the MPFR library, I am trying to calculate the square root of a large number but I am not sure how to define the precision of the mpft_t root variable or what is the best way of rounding. my code is…
2
votes
0 answers

Eigen3 Boost MPFR segfault when alignment is disabled

I'm running into a strange segfault issue when I try to use Boost.Multiprecision to wrap MPFR and disable Eigen's alignment assumptions. Example test code: #include #include #include int…
helloworld922
  • 10,801
  • 5
  • 48
  • 85
2
votes
1 answer

Mysterious stackoverflow exception in boost::multiprecision::gmp_float::operator=?

I am trying to calculate pi for one of my university project using Ramanujan's formula for arbitrary number of digits after the floating point. For the job, I am using boost::multiprecision library that is simply wrapper around mpfr and mpir I…
kuskmen
  • 3,648
  • 4
  • 27
  • 54
2
votes
2 answers

Which versions of GMP, MPC, and MPFR were used to compile GCC?

I've been asked to recreate a build of GCC 4.5.1 on both Red Hat 6 and Solaris 10. There are existing Red Hat 6 machines with 4.5.1 installed. The last Solaris 10 machine recently ate itself; hence, my inherited joy. No one around knows what…
Mike H
  • 31
  • 5
2
votes
2 answers

Why does GCC (MinGW-w64) return a 'fatal error: no input files' when building MPFR?

I'm unable to diagnose the cause of an error when attempting to build MPFR 4.0.1 with MinGW-w64 8.1.0. I'm using msys2 and Windows 10. The result of running mingw32-make is: $ make Making all in doc make[1]: Entering directory…
user9525268
2
votes
1 answer

Converting mpfr_t (or any other arbitrary precision library type) to __float128

I guess I have two questions really. 1) I was wondering if anyone knows a way to convert mpfr_t types into __float128 types in GCC. I've looked around and found a thread on the mpfr bugfixes site where someone discusses their attempt to write a…
Bradley Swain
  • 804
  • 5
  • 12
2
votes
1 answer

Scientific notation with Rmpfr in R

I am testing some calculation based on the example code from Rmpfr in R. The test is as follows: ns <- mpfr(1:24, 120) ; factorial(ns) However, in my output the result is: [1] 1e0 2e0 …
exteral
  • 991
  • 2
  • 12
  • 33
2
votes
2 answers

Correct way to restrict functions to specific data types

I am currently working with the following data types in c++: double, boost::interval< double >, and boost's mpfr/mpfi types (mpfr_float, mpfr_float_50, ..., mpfi_float, mpfi_float_50, ...) I am writing some overloaded functions for any pair of these…
Michael Burr
  • 199
  • 10
2
votes
1 answer

Converting MPFR numbers to string and back

I'm trying to convert MPFR number to string and then back. The code I'm using is: int base = 10; int input = 25; mpfr_t number; mpfr_inits2(53, number, (mpfr_ptr) 0); mpfr_set_d(number, input, MPFR_RNDD); mpfr_printf ("mpfr = %.17Rg\n",…
user1335014
  • 351
  • 1
  • 4
  • 13
2
votes
1 answer

Python Numpy Exponential Value from Array of BigFloats

I'm trying to compute the natural log of the exponential plus the median of an array but precision of the floating point numbers has to be at 2000 or the answer will always be 0. Here is what I have so far: import bigfloat x =…
Kenneth Orton
  • 399
  • 1
  • 11
2
votes
1 answer

Write mpfr objects to file in R

I have a variable, which contains mpfr object. > currentPrice <- mpfr(as.character(reduceData[1, 2])) > currentPrice 1 'mpfr' number of precision 97 bits [1] 14.22857142857142857142857143301 How can I write this value to text file without…
2
votes
0 answers

I am getting error while doing make GCC(Makefile:4999: recipe for target 'configure-stage1-gmp' failed)

These are the steps i followed for installing GCC Downloaded & extracted GCC, GMP, MPFR, MPC(latest versions). renamed GMP,MPFR,MPC without versions and moved GMP, MPFR, MPC to source folder of GCC took path of GCC and exported library "export…
viki
  • 37
  • 1
  • 4
2
votes
2 answers

error : declared as function returning an array in c (mpfr libary)

I'm beginner with mpfr, I wrote this program to make a specific calculation and get it like you see,but I don't know why this error appear, this is the most important my code: mpfr_t myfct(int n) { /......./ return…
wolfgunner
  • 119
  • 2
  • 13
2
votes
1 answer

Subnormal numbers in different precisions with MPFR

I would like to emulate various n-bit binary floating-point formats, each with a specified e_max and e_min, with p bits of precision. I would like these formats to emulate subnormal numbers, faithful to the IEEE-754 standard. Naturally, my search…
James Paul Turner
  • 791
  • 3
  • 8
  • 23
2
votes
0 answers

Multiple Precision Complex Number in R

Complex Number in R is defined as: function (length.out = 0L, real = numeric(), imaginary = numeric(), modulus = 1, argument = 0) I've a program which aims to process multiple precision values in the real case and complex case. R does not support…
complextea
  • 393
  • 1
  • 5
  • 16