How can I formulate the following idea?
I have p (parameter). I want to know how many times I need to divide it by 2 until the result of the division is around d.
For example, let p = 400 and d = 25. I need to divide it 4 times by 2 to get d ~ 20.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Trivial: d*2^n = p, hence n = log(p/d)/log(2). Then just round up n in the direction you want.