A newbie question

David Gillies daggillies at gmail.com
Mon Aug 17 15:59:12 CEST 2009


Digit extraction  in this case is tantamount to base conversion. For a
non-power of two base this is hard.

On Sun, Aug 16, 2009 at 8:09 PM, Bird, John<John.Bird at ca.com> wrote:
> Hi Guys
>
>
>
> I'm looking through the manual for a function that pulls out the Xth
> digit of an int.
>
> So something like this:
>
>
>
> unsigned long uslong;
>
>
>
> mpz_set_str(n, "111111111111111911111", 10);
>
> uslong = mpz_get_index_ui(n, 5);
>
>
>
> uslong would now equal 9
>
>
>
> The closest thing in the manual I can find is mpz_getlimbn. Is this the
> function I am looking for? If so, can anyone suggest an efficient way of
> calculating an "index" from that?
>
>
>
> Many thanks,
>
> John
>
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-discuss
>



-- 
David Gillies
San Jose
Costa Rica


More information about the gmp-discuss mailing list