0
$\begingroup$

The number of digits (words) in a base Beta of any positive integer a is 1 + floor(log(a)) where the log is in base Beta. When the base Beta = 2 this is just the number of bits. That is 1 + lg(a) is the number of bits. I want to prove that floor(log(a)) = floor(lg(a))/BPW where BPW is the number of bits per word and lg is the log in base 2. So if Beta = pow(2, BPW) then I want to prove what always seemed obvious; the number of words in base Beta is 1 + floor(lg(a)/BPW) = 1 + floor(lg(a))/BPW but I am struggling with the floor function. How can I be sure that floor(lg(a)/BPW) = floor(lg(a))/BPW?

$\endgroup$
  • $\begingroup$ I found and proved the relationship floor(x/n) = floor(x)/n. That fixes my problem. $\endgroup$ – Peter Dixon Mar 25 '15 at 19:36
  • $\begingroup$ What about floor(1/2) and floor(1)/2? One is 0 and the other is 1/2. $\endgroup$ – Regret Mar 26 '15 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.