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
3
votes
1 answer

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 and mpfr packages. I know somebody who successfully…
Ying
  • 163
  • 4
3
votes
1 answer

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) # Doesn't work -- should it? identical(test, list.mpfr) #…
Adrian
  • 3,138
  • 2
  • 28
  • 39
3
votes
1 answer

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 here: install mpfr via precompiled mpfr library), I…
LCFactorization
  • 1,652
  • 1
  • 25
  • 35
3
votes
1 answer

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 switched to MPFR library, and all went file. But…
3
votes
5 answers

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 considering the following alternatives: a) cephes…
Carlos
  • 1,455
  • 2
  • 14
  • 15
3
votes
1 answer

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 < mpreal >.
Nick
  • 499
  • 5
  • 13
2
votes
2 answers

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) var); only to receive this error message from…
Sir Whiteout
  • 123
  • 1
  • 7
2
votes
1 answer

MPFR: how to get mpfr_ptr from a mpfr_t variable?

everyone I want to use mpfr_sum function to get the sum of a mpfr_t array, but I don't know how to get mpfr_ptr from mpfr_t. The following is a example: mpfr_t sum, v[100]; mpfr_init2(sum, 512) for(int i = 0; i < 100; ++i) mpfr_init2(v[i], 512); //…
2
votes
1 answer

Why does gcc misinterpret this macro?

I have found the large-precision code of MPFR C++ to be very useful, and have used it successfully in the past. Recently, while developing a new app, I encountered an enormous number of compiler errors in their header code (mpreal.h). I have…
ghborrmann
  • 101
  • 6
2
votes
2 answers

How should GMP/MPFR limbs be interpreted?

The arbitrary precision libraries GMP and MPFR use heap-allocated arrays of machine word-sized integers to store the limbs that make up the high precision number/mantissa. How should this array of limbs be interpreted to recover the arbitrary…
definelicht
  • 428
  • 2
  • 14
2
votes
1 answer

MPFR: undefined reference | incorrect installation?

I am trying to use mpfr library on Ubuntu 20.04. I have installed it with: sudo apt-get install -y libmpfr-dev libmpfr6 And I have a simple test code (copied from a tutorial somewhere): #include #include int main() { mpfr_t…
maciek
  • 1,807
  • 2
  • 18
  • 30
2
votes
0 answers

Why would one define "typedef someStruct someName[1]" as MPFR does?

In MPFR the basic data types are defined as typedef struct { [...] } __mpfr_struct; typedef __mpfr_struct mpfr_t[1]; typedef __mpfr_struct *mpfr_ptr; and functions in the header are using mpfr_ptr, e.g. void mpfr_init (mpfr_ptr) but the docs are…
oli
  • 659
  • 1
  • 6
  • 18
2
votes
2 answers

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 documentation says the output specifiers are ‘a’ ‘A’ …
sdpoll
  • 426
  • 2
  • 12
2
votes
1 answer

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 rounding mode is used, but instead for all cases it…
Jay
  • 23
  • 4
2
votes
1 answer

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/MPFR from source code, I used the…
Wassim
  • 386
  • 2
  • 15
1 2
3
13 14