Prev: Protovision Update June 2010
Next: For Sale: CMD Hard Drive 1000, (2) Power Supplies, Manual+Disks...
From: Harry Potter on 2 Jul 2010 11:05 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.
From: Joe Forster/STA on 2 Jul 2010 11:20 On Jul 2, 5:05 pm, Harry Potter <maspethro...(a)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. I am working on some > complex file compression techniques. I also want powers, roots, > exponents and logs for another time. http://en.wikipedia.org/wiki/Logarithm etc.
From: Maciej Witkowiak on 3 Jul 2010 05:38 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/
From: Harry Potter on 5 Jul 2010 08:48
On Jul 3, 5:38 am, Maciej Witkowiak <y...(a)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. 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/ Thank you, both of you! |