On Thu, Nov 14, 2002 at 09:18:39AM -0600, Chris Bourke wrote:
I'm working on a project right now using GNU's multiprecision library. However, and unfortunately, there are no library functions to do any logarithmic functions.
I'm merely trying to get a ceiling (or floor) or the lg (base 2) of a large integer. Of course, I could always send it into a loop requiring O(lg^3(n)) to get it, but I know there must be a way to do a simpler approximation, especially since I don't need very high precision.
I asked this question of some math associates and they suggested the usual taylor series, etc. However, I am unable to find a satisfactory series for a large n (taylor only works for x<1, right?).
Any help would be appreciated.
You can use mpfr library which is addon for GMP, which has all the functions you want.
-- Taw, author of Ruby bindings to GMP