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

R write mpfr data (Rmpfr)

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 = "Rmpfr")" to a data.frame How would I go about…
Plinth
  • 289
  • 1
  • 13
2
votes
1 answer

Symbol not found: _mpfr_acos, Expected in: flat namespace

I am trying to run a Python script that includes multiple packages. The error I continuously get involves the mpfr.so file (MPFR module). Here are the contents of the entire message: Traceback (most recent call last): File…
rebekah
  • 21
  • 1
2
votes
1 answer

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: > a<- mpfr(sqrt(det(M)), precBits=512);a 1 'mpfr'…
Vassilis Chasiotis
  • 427
  • 1
  • 3
  • 15
2
votes
2 answers

boost serialization of mpfr_float

I would like to serialize a custom class containing an boost::multiprecision::mpfr_float as a member. It says here in the Boost.Serialization documentation that a type T is serializable iff at least one of 5 properties is true, and here at the…
ofloveandhate
  • 199
  • 1
  • 10
2
votes
1 answer

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 (GMP_RNDD, GMP_RNDU, GMP_RNDN, GMP_RNDZ) So…
Silmaersti
  • 23
  • 3
2
votes
2 answers

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(int x); But when I try to compile I get the…
JKzzz
  • 21
  • 1
2
votes
1 answer

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 bunch of symbols associated with…
davidsd
  • 771
  • 4
  • 18
2
votes
1 answer

MPFR not copying data correctly

#include #include #include #include #include #include mpf_t epi; int main(int argc, char * * argv) { mpf_t e; mpf_t pi; mpfr_t er; mpfr_t pir; FILE *a; FILE *b; …
phyrrus9
  • 1,441
  • 11
  • 26
2
votes
0 answers

mpfr_free_cache in destructor - a good idea?

I need arbitrary precision in a C++ program, so I am using the well-known, lightweight C++-wrapper MPFRC++ over the multi-precision floating point C-library MPFR. I have been having memory issues. Namely, a malloc fails within an MPFR function.…
cmo
  • 3,762
  • 4
  • 36
  • 64
1
vote
1 answer

How to use a function with mpfr data when the type of mpfr triggered the atomic error?

Example: library(Rmpfr) x.mpfr <- 1:11 + Rmpfr::mpfr(1.e20, precBits = 1000) var(x.mpfr) Error in var(x.mpfr) : is.atomic(x) is not TRUE Question: How to make the function var() run with the mpfr vector x.mpfr? To be precise, here the var() is a…
J.Z.
  • 415
  • 2
  • 11
1
vote
1 answer

R language: unexpected precision returned from min.mpfr call

Consider: > foob <- as.bigz(5:7) > min(foob) Big Integer ('bigz') : [1] 5 > .bigz2mpfr(prev) 1 'mpfr' number of precision 4 bits [1] 5 > min(.bigz2mpfr(foob)) 1 'mpfr' number of precision 53 bits [1] 5 > min(mpfr(5:7,5)) 1 'mpfr' number of…
Carl Witthoft
  • 20,573
  • 9
  • 43
  • 73
1
vote
1 answer

gmpy2 unexpected behavior of pow() method on mpfr type

I have reproducibly found that using gmpy2's pow function on its mpfr type returns 0 on any x value <= .5 >>> from gmpy2 import mpfr >>> x = mpfr('.5') >>> y = mpfr('2') >>> print(pow(x, 2)) 0.0 -> should be .25 >>> print(pow(y, 2)) 4.0 ->…
1
vote
0 answers

Install Rmpfr package in RStudio on remote server

I often use R / RStudio that is located on a remote server. Unfortunately, I do not have root / sudo / administrator access on this server, so any installations need to be done only in ~/. I know that Rmpfr relies on libmpfr4 and mpfr.h. I have mpfr…
tlbello
  • 43
  • 5
1
vote
1 answer

MPFR Accuracy and precision problem, binding to pyton with ctypes

I am trying to call the "fpow" C function from python with "fpow" wrapper. It works but unfortunately both precision and accuracy is lacking. I guess that my use of mpfr is incorrect. How can I solve this? numeric.c #include #include…
aras edeş
  • 53
  • 1
  • 7
1
vote
0 answers

When have enough bits of my series with non-negative terms been calculated?

I have a power series with all terms non-negative which I want to evaluate to some arbitrarily set precision p (the length in binary digits of a MPFR floating-point mantissa). The result should be faithfully rounded. The issue is that I don't know…
user2373145
  • 332
  • 2
  • 14