Binary output of mpf_get_str() has too many bits?

John Westwood john at westwoodsolutions.com
Wed May 19 21:17:35 CEST 2010


Sorry, I don't know.

Maybe one of the developers can answer?


On Wednesday 19 May 2010 17:38:42 Rick Regan wrote:
> On Wed, May 19, 2010 at 12:06 PM, John Westwood
> 
> <john at westwoodsolutions.com>wrote:
> > The description of mpf_get_str in the manual states:
> >
> > "If n_digits is 0 then that accurate maximum number of digits are
> > generated."
> >
> > So you could try specifying n_digits as 64, 96 and 128 and you should
> > receive
> > the correct number of bits when using a base of two.
> >
> > John
> 
> I know that if I specify the number of digits I'll get that amount, but
> since I have n_digits = 0, I'm expecting the "accurate maximum number of
> digits." Why is it greater than the precision reported by get_prec()?
> 
> Stepping through the program I see the following values for f internally:
> 
> 64: mp = 0x0012ff3c {_mp_prec=3 _mp_size=4 _mp_exp=0 ...}
> 96: mp = 0x0012ff3c {_mp_prec=4 _mp_size=5 _mp_exp=0 ...}
> 128: mp = 0x0012ff3c {_mp_prec=5 _mp_size=6 _mp_exp=0 ...}
> 
> So does that mean what get_prec() is reporting is actually 1 limb (32 bits)
> less than what's actually used?
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-discuss
> 


More information about the gmp-discuss mailing list