I need to be able to calculate the logarithm to base 2 of a number,
but I am limited to a high school education. I am working on some
complex file compression techniques. I also want powers, roots,
exponents and logs for another time.
|
|
0
|
|
|
|
Reply
|
maspethrose7 (119)
|
7/2/2010 3:05:30 PM |
|
On Jul 2, 5:05=A0pm, Harry Potter <maspethro...@aol.com> wrote:
> I need to be able to calculate the logarithm to base 2 of a number,
> but I am limited to a high school education. =A0I am working on some
> complex file compression techniques. =A0I also want powers, roots,
> exponents and logs for another time.
http://en.wikipedia.org/wiki/Logarithm etc.
|
|
0
|
|
|
|
Reply
|
Joe
|
7/2/2010 3:20:46 PM
|
|
Harry Potter wrote:
> I need to be able to calculate the logarithm to base 2 of a number,
> but I am limited to a high school education. I am working on some
For integer arithmetics, it can be found very easily:
floor(log_2(n))+1 is equal to the number of bits needed to store n. Basically
it is the position of the last '1' in binary representation of n when counting
from right to left.
E.g. for n=14 you need 4 bits to store that number and the value of log_2(14)
is somewhere in (3,4) interval.
If you would need precise answer, for whatever reason, then:
log_2(n)=ln(n)/ln(2)
> complex file compression techniques. I also want powers, roots,
> exponents and logs for another time.
Then you need to find ln() and exp() implementations, those functions can be
combined to calculate powers and roots.
ytm
--
Najlepsza sygnatura to brak sygnatury.
http://bossstation.dnsalias.org/
|
|
0
|
|
|
|
Reply
|
Maciej
|
7/3/2010 9:38:38 AM
|
|
On Jul 3, 5:38=A0am, Maciej Witkowiak <y...@elysium.pl.andremowe.me>
wrote:
> Harry Potter wrote:
> > I need to be able to calculate the logarithm to base 2 of a number,
> > but I am limited to a high school education. =A0I am working on some
>
> For integer arithmetics, it can be found very easily:
> floor(log_2(n))+1 is equal to the number of bits needed to store n. Basic=
ally
> it is the position of the last '1' in binary representation of n when cou=
nting
> from right to left.
> E.g. for n=3D14 you need 4 bits to store that number and the value of log=
_2(14)
> is somewhere in (3,4) interval.
>
> If you would need precise answer, for whatever reason, then:
> log_2(n)=3Dln(n)/ln(2)
>
> > complex file compression techniques. =A0I also want powers, roots,
> > exponents and logs for another time.
>
> Then you need to find ln() and exp() implementations, those functions can=
be
> combined to calculate powers and roots.
>
> ytm
>
> --
> Najlepsza sygnatura to brak sygnatury.http://bossstation.dnsalias.org/
Thank you, both of you!
|
|
0
|
|
|
|
Reply
|
Harry
|
7/5/2010 12:48:53 PM
|
|
|
3 Replies
124 Views
(page loaded in 0.079 seconds)
|