I am reading this material to understand the basics of number system.
I am stuck at a point in that material where it writes the algorithm to convert a decimal number to binary number.
The heading of that part where I am stuck is Decimal to Base
The algorithm (may be presented less than faithfully, please refer the link) it mentions there is:
- Let $p = \lfloor \sqrt{V} \rfloor$
- Let $v = \lfloor \dfrac V {B^p} \rfloor$
(v is the next digit to the right)- Make $V = V − v * B^p$
- Repeat steps 1 through 3 until $p = 0$
It is explaining by taking an example of converting decimal number 236 to binary.
I am not getting how it is calculating the 1st step, i.e. to get the value of p.
It writes that p = int(square root of V)
Now, square root of 236 = 15.36229149573721635154
As per point number 1, p = integer part of 15.36229149573721635154 So, I remove the decimal part and p then becomes 15. But the material there says it is 7.
I can't get what is happening here. I am stuck.