[MPFR] Is there a way to extract certain portions of digits from GMP or MPFR numbers?

Vincent Lefevre vincent at vinc17.org
Thu Jan 4 10:48:47 CET 2007


Hi,

On 2007-01-03 20:38:41 -0800, Michael wrote:
> Suppose my program needs to deal with huge numbers with thousands of
> precision digits. However, the focus is on the last 10s of digits of
> these huge numbers. That's to say, the final results is between 0
> and 1, which is obtained form a series of calculations of huge
> numbers, and then add and subtract, so only the last a few digits
> remain, but the intermediate numbers can be as large as gamma(1000).
> 
> Is there a way that I can extract the last N digits from large GMP
> or MPFR numbers? Let's say N=10?

For a floating-point number, extracting the last N digits doesn't have
much sense, that's why MPFR provides no function for that. Well, this
has some sense only when the result is an integer, in which case you
can use GMP.

-- 
Vincent Lefèvre <vincent at vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)


More information about the gmp-discuss mailing list