Questions tagged [mpfr]
The MPFR library is a C library for multiple-precision floating-point computations with correct rounding.
189
questions
122votes
6answers
118kviews
How to install GCC piece by piece with GMP, MPFR, MPC, ELF, without shared libraries?
How do I install GCC (the GNU Compiler Collection) piece by piece, using the current version,
using the correct versions of dependencies, not using a package manager (like yum, rpm, apt, dpkg), and ...
87votes
5answers
108kviews
Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+
I downloaded GCC 4.5 from http://www.netgull.com/gcc/releases/gcc-4.5.0/ but when I try to setup / build I am getting below error:
Linux:>~/shared_scripts/bin/gcc/gcc-4.5.0 1040> /x/home/...
20votes
5answers
11kviews
dyld: Library not loaded: /usr/local/lib/libmpfr.4.dylib
When I run "make" on a project I get this error:
dyld: Library not loaded: /usr/local/lib/libmpfr.4.dylib
Referenced from: /Users/Petrov/Downloads/mips/bin/../libexec/gcc/mipsel-elf/4.8.1/cc1
...
14votes
6answers
17kviews
Cannot configure gcc - mpfr not found
I'm installing gcc 4.5.2 with mpc 0.8.2, mpfr 3.1.0, and gmp 5.0.2. I've copied each of the mpc, mpfr, and gmp directories into the gcc-4.5.2 directory (removing the version tags). GCC successfully ...
9votes
2answers
28kviews
Building GMP library with Visual Studio?
Is there an easy way to build the GMP (GNU Multiple Precision Arithmetic Library, http://gmplib.org) under Windows, using Visual Studio 2005? I tried to find information about building the library ...
8votes
1answer
7kviews
How to install GNU MPFR library on pythonanywhere
I'm trying to install bigfloat and I am getting this message that seems to indicate I need the mpfr library first. How do I do this?
The message:
running build_ext building 'mpfr' extension ...
8votes
7answers
36kviews
GCC cant find GMP, MPFR and MPC libraries
I am trying to cross-compile GCC on Mac OS 10.5.7. I used this command to configure GCC after installing GMP, MPFR, and MPC:
../gcc-4.5.0/configure --target=$i586-elf --prefix=/usr/local/cross \
-...
6votes
3answers
15kviews
cannot open libmpfr.so.4 after update on ubuntu 18.04
Today I updated my laptop to Ubuntu 18.04.
Now I try to run a program for my bachelor thesis, but it gives me the following error message:
error while loading shared libraries: libmpfr.so.4: ...
6votes
2answers
1kviews
different behaviour or sqrt when compiled with 64 or 32 bits
I'm using sqrt() function from math library, when I build for 64 bit using -m64 I'm getting correct result but when I build for 32 bit I have very inconsistent behaviour.
For example on 64bit
...
6votes
1answer
123views
Can I use a `mpfr_t` as both input and output argument?
The question is very simple and direct, but I could not find an answer on the documentation. If I have
mpfr_t a, b;
Can I do something like
mpfr_add(a, a, b, rnd);
This would compute the sum of a ...
5votes
3answers
2kviews
Compiling GMP/MPFR with Emscripten
Alright, this has been driving me insane. I've been trying this for at least a month, and no where on the internet is helping.
I followed the steps of this. Not even the example works when I do these ...
5votes
2answers
9kviews
How to check the version of GMP, MPFR and CamlIDL?
My question is simple... How could I check the version of GMP installed on my machine? What about MPFR? And What about CamlIDL?
Thank you very much
5votes
1answer
690views
Using Rmpfr to round with precision in R
I'm trying to use the Rmpfr library with the round() function to apply the round half to even rule and achieve correct results, without errors due the finite precision of float point values, as ...
5votes
2answers
802views
I need to calculate Stirling's approximation very fast
I'm writing a small library for statistical sampling which needs to run as fast as possible. In profiling I discovered that around 40% of the time taken in the function is spent computing Stirling's ...
5votes
2answers
872views
How to send GMP or MPFR types with MPI
I trying to send variables of type mpfr_t using MPI_Scatter. For example:
mpfr_t *v1 = new mpfr_t[10];
mpfr_t *v2 = new mpfr_t[10];
MPI_Scatter(v1, 5, MPI_BYTE, v2, 5, MPI_BYTE, 0, ...
5votes
0answers
3kviews
GMP & MPFR not found by cmake, but are installed
I'm trying to compile the plll library which require boost, GMP and MPFR on mac os X 10.11.
I've installed boost, GMP and MPFR by homebrew, then i've launched cmake in a dir build in plll, but I get ...
4votes
3answers
774views
Haskell FFI / C MPFR library wrapper woes
In order to create an arbitrary precision floating point / drop in replacement for Double, I'm trying to wrap MPFR using the FFI but despite all my efforts the simplest bit of code doesn't work. It ...
4votes
4answers
3kviews
Getting MPFR to build on cygwin
I spent the whole day setting up GCC as per
http://cygwin.wikia.com/wiki/How_to_install_GCC_4.3.0
On the gcc make step, it told me it needed a c++ compiler to continue for whatever reason,
So I ...
4votes
1answer
775views
Using big integers with gmp and machine limits
I wonder if it is possible to use integers bigger than the value of .Machine$double.xmax (~1.79e308) in R. I thought that by using e.g. Rmpfr or gmp libraries in R you could assign values of any size, ...
4votes
1answer
145views
There is a real reason for gcc to be so conservative with its dependecies ? ( MPFR, GMP, MPC )
I'm wondering if someone knows why gcc tends to be so conservative about the versions of the libraries to use to compile and build gcc itself .
The main reasons why I'm asking this are :
I think ...
4votes
1answer
2kviews
How to use complex numbers with boost::multiprecision::mpfr?
According to https://stackoverflow.com/a/17932632/1700939, it should be possible to use complex numbers with boost::multiprecision with gcc-4.7. This indeed works fine with boost::multiprecision::...
3votes
5answers
2kviews
Platform independent math library
Is there a publically available library that will produce the exact
same results for sin, cos, floor, ceil, exp and log on 32 bit and
64 bit linux, solaris and possibly other platforms?
I am ...
3votes
3answers
18kviews
GMPY2 doesn't install
EDIT: I'm using Win 10 and Ubuntu from the app store
I have tried to install gmpy2 by using:
apt-get install libgmp-dev
apt-get install libmpfr-dev
apt-get install libmpc-dev
and also downloaded ...
3votes
1answer
2kviews
How to install Rmpfr on Ubuntu 18.04?
After install.packages("Rmpfr") I'm getting this error
configure: error: Header file mpfr.h not found; maybe use
--with-mpfr-include=INCLUDE_PATH
ERROR: configuration failed for package ‘Rmpfr’
I ...
3votes
2answers
2kviews
python 'bigfloat' package installation issues
I'm trying to get the package 'bigfloat' installed on my Mac (OS X 10.8.4), and I'm running into some issues. The package 'bigfloat' requires two other dependencies: 1) mpfr, and 2) gmp.
I've ...
3votes
2answers
2kviews
Installation of package ‘Rmpfr’ had non-zero exit status in R
I am unable to install the Rmpfr package in R. I am trying to use the CVXR package in order to solve OR problems. Since Rmpfr package is needed as a pre-requisite, I tried installing the same using ...
3votes
1answer
433views
Collapse list of mpfr objects into single mpfr vector
I must be missing something obvious:
library(Rmpfr)
list.mpfr <- list(mpfr(10, 128), mpfr(20, 128)) # I'd like to turn this into mpfr(c(10, 20), 128)
test <- c(list.mpfr, recursive=TRUE) # ...
3votes
3answers
17kviews
How to install MPFR and GMP for C++ on visual studio
As I understand, I should first install GMP. The only tutorial I found for this purpose is http://cs.nyu.edu/exact/core/gmp/ and when I reach step 3: "Open gmp.dsw (gmp.vcproj for VC++.Net) to build ...
3votes
1answer
335views
I need to convert mpfr real number to gmp bit-integer number
I am writing a program, which operates on integers and floating-points. At first, i used GMP library for them, but GMP doesn't have functions such as sin, cos, exp and others at floating points. So, i ...
3votes
1answer
603views
MPFR: get sin of mpf_class
I installed gmp and mpfr on my environment. Now I can successfully
#include <gmpxx.h>
#include <mpfr.h>
#include <mpf2mpfr.h>
Now, say that I initialize an mpf_class with some ...
3votes
1answer
200views
Undefined symbols error related to "__mpf_struct" for OS X 10.10.2
I am trying to compile a program from
https://github.com/davidsd/sdpb
with gcc-4.9, boost 1.57.0, gmp-6.0.0a, and mpfr-3.1.2 on OS X 10.10.2, but I keep getting errors seemingly related to the gmp ...
3votes
1answer
2kviews
fast arbitrary precision c++ library: is __float128 faster than MPFR?
I know there are a couple of thread on similar topics ( What's the best (for speed) arbitrary-precision library for C++? and The best cross platform (portable) arbitrary precision math library ) ...
3votes
1answer
572views
Using MPFR (mpreal) with Eigen3
I've seen on the Eigen3 website that there is an "unsupported" module for MPFR multi-precision data type. Does anyone know how reliable this is?
My main goal is not only to use mpreal, but complex &...
3votes
1answer
293views
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 ...
3votes
0answers
133views
gmp-mpfr-sys fails to build on macOS catalina 10.15.6
I am on macOS catalina 10.15.6. I am trying to use the rug crate in rust, particularly, the float library that uses MPFR. I am unable to compile the code due to a segmentation fault. The exact error ...
2votes
2answers
3kviews
How to use printf with mpfr and mpreal
What is the correct syntax for using printf and its cousins sprintf and fprintf to display the value of mpreal-type variables? I have tried the naive casting to double:
printf ("... %g ...", (double) ...
2votes
1answer
217views
How to set rounding mode in Boost Multiprecision when using MPFR
I am trying to figure out how I can format mpfr_float numbers using a rounding mode in Boost Multiprecision. In the below example, I expect 1.55 to round to either 1.5 or 1.6 depending on which ...
2votes
2answers
144views
Why is mpfr_printf different than printf for hex float (%a conversion specifier)?
I'm comparing values from regular floating point arithmetic and using a high-precision MPFR number as a baseline. When printing, I'm confused why the following code is output different.
The MPFR ...
2votes
2answers
102views
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 ...
2votes
2answers
265views
mpfr_t function declaration error
I'm trying to create a function that returns type mpfr_t but I get an error in its declaration. The header file declaration looks like (mpfr.h is local):
#include "include/mpfr.h"
mpfr_t calcWinProb(...
2votes
1answer
4kviews
How to rebuild the mpfr.svn.build.vc10.zip in my own computer?
This question is about how to install "mpfr" with visual studio 2010 in windows OS.
Though I have actually solved the mpfr installation problem by using a pre-compiled mpfr library (see the details ...
2votes
1answer
733views
MPFR Rounding 0.9999 to 1?
I'm attempting to store the value 0.9999 into an mpfr_t variable using the mpfr_set_str() function
But 0.9999 is rounded to 1 (or some other value != 0.9999) during storage, no matter the round value ...
2votes
1answer
612views
MSYS2 MinGW64 to build GMP/MPFR on Windows as static library, and link them in MSVC project compiled with CL
I'm working using Visual Studio 2019. I have a project that requires GMP and MPFR ; as far as I know, there are no recent binaries available for Windows and one has to build his own.
To build GMP/...
2votes
1answer
280views
gmpy2 mpfr values are limited to 301,033 digits of which the 301,032 digits are correct
I am writing a Python3 (64-bit) program to calculate pi to at least a million digits using the gmpy2 module on 64-bit Windows 10. I'm using the Chudnovsky algorithm. The series arithmetic is genius, ...
2votes
1answer
243views
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] ...
2votes
1answer
753views
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, ...
2votes
1answer
429views
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 ...
2votes
1answer
175views
R write mpfr data (Rmpfr) [closed]
I'm have a mpfrArray in R that I am trying to write to file but I get the error message:
Error in as.data.frame.default(x[[i]], optional = TRUE) :
cannot coerce class "structure("mpfr1", package = "...
2votes
1answer
1kviews
How to check if a number is a perfect square by using mpfr package in R?
I have a determinant which I know is a square of an integer, but because its value is bigger than .Machine$integer.max I used the mpfr package.
But I still have problems.
Here is the algorithm:
>...
2votes
1answer
148views
Does one still have to recompile GHC to use HMPFR?
On the page for the Haskell MPFR bindings HMPFR, they explain that in order to use the library one has to recompile ghc with modifications -- either with a different integer library or by renaming a ...