[prev in list] [next in list] [prev in thread] [next in thread]
List: gmp-discuss
Subject: Retrieve the logarithm of number in a specified base ?
From: saverio () mat ! uab ! es (Saverio Trioni)
Date: 2004-12-28 3:22:12
Message-ID: 41D03C39.70702 () mat ! uab ! es
[Download RAW message or body]
If you want to get just the *integer* part of the logarithm of an
*integer* over an *integer* base, maybe it is better to recursively
divide, using just mpz integer functions.
Sketch of the idea
(assuming number is greater than base)
(and using standard notation, to be readable)
mpz_t number, base;
long exponent=0;
while (number>base)
{
exponent++;
number/=base;
}
return exponent;
The actual function to perform de division should be (i think)
mpz_tdiv_q(number,number,base)
I hope you get the idea.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic